language problem in C ..
-
hi , i made a simple application for encryption and decryption of a text file using c language. i want to know if a text file contains language symbols other than English , than how C language take care of it. Please also tell me if we can add other languages support in C language.
-
hi , i made a simple application for encryption and decryption of a text file using c language. i want to know if a text file contains language symbols other than English , than how C language take care of it. Please also tell me if we can add other languages support in C language.
Check out http://en.wikipedia.org/wiki/Unicode[^]. You may want to use strings of unicode characters rather than just
char
Of course then you will also have to figure out and use encodings. Here's a good introduction on Unicode and encodings: http://www.joelonsoftware.com/articles/Unicode.html[^] I'm probably not the best person to ask about what libraries and system functions to use, but it shouldn't be too hard to google for. ;) I do know Visual Studio provides built-in support for unicode strings, it's right in the project options. -
hi , i made a simple application for encryption and decryption of a text file using c language. i want to know if a text file contains language symbols other than English , than how C language take care of it. Please also tell me if we can add other languages support in C language.
IsTextUnicode function http://msdn.microsoft.com/en-us/library/windows/desktop/dd318672(v=vs.85).aspx[^] Unicode in Visual C++ http://msdn.microsoft.com/en-us/library/cc194799.aspx[^] Conversion between Unicode UTF-16 and UTF-8 in C++/Win32 http://msmvps.com/blogs/gdicanio/archive/2010/01/04/conversion-between-unicode-utf-16-and-utf-8-in-c-win32.aspx[^] Here is an example http://www.codersource.net/win32/win32-advanced/unicode-to-ascii-conversion.aspx[^]
//Check if the file is UNICODE
int IsUnicodeFile(char* szFileName)
{
FILE *fpUnicode;
char l_szCharBuffer[80];//Open the file if((fpUnicode= fopen(szFileName,"r")) == NULL) return 0; //Unable to open file if(!feof(fpUnicode)) { fread(l\_szCharBuffer,80,1,fpUnicode); fclose(fpUnicode); if(IsTextUnicode(l\_szCharBuffer,80,NULL)) { return 2; //Text is Unicode } else { return 1; //Text is ASCII } } return 0; // Some error happened
}