I have a VC++ project in Visual Studio 2008.
It is defining the symbols for unicode on the compiler command line (/D "_UNICODE" /D "UNICODE"
), even though I do not have this symbol turned on in the preprocessor section for the project.
As a result I am compiling against the Unicode versions of all the Win32 library functions, as opposed to the ANSI ones. For example in WinBase.h, there is:
#ifdef UNICODE
#define CreateFile CreateFileW
#else
#define CreateFile CreateFileA
#endif // !UNICODE
Where is the unicode being turned on in the VC++ project, how can I turn it off?
char
towchar_t
, which is Window's crappy way of doing "Unicode". Give me UTF-8 any day over some botched UTF-16 implementation. – Cairistionawchar_t
is synonymous for Unicode/UTF-16LE encoding. Crappy or not, it is the native character encoding in Windows, exposed through the Windows API. If you wish to interface with it, you better learn to appreciate it. Incidentally, .NET strings use UTF-16 encoding as well. So does NTFS. Or Java strings. – NocturnUNICODE
helps to ensure that you do not goof up and accidentally pass a UTF-8 string (typed aschar
) to an API function that is expecting an ANSI string (also typed aschar
, very different from UTF-8). Note that, contrary to the expectations of some programmers, UTF-8 is not a valid ANSI code page on Windows. @thomas – Semiprofessional