Cannot use non-english characters correctly in your source code, which triggers elusive bugs when calling Windows APIs
This problem can cause the following elusive bugs by AUTOMATIC ENCODING CONVERSION without any warnings or errors:
- Cannot read or write strings of the type WCHAR , LPCWSTR... correctly; can not declare any non-English wchar_t with the format of L"おかしい" correctly. e.g: L"正£" cannot be correctly received by the windows API. You cannot easily notice that since you check the memory\the variables, those wchar_t variables are correctly encoded into UTF-16LE. But those variables cannot be correctly passed between services. If you only use those WChar[] in your program without calling any APIs, everything will be ok.
- Cannot use the CString correctly. CString st = _T("正£"); will actually create L"æ£Â£"
- Cannot use Windows API correctly: the API can receive and use those arguments without any warnings, yet non-ASCII bytes will be combined together to trigger unexpected behavior.
- In SAPI5, you can speak English text but cannot speak non-English text correctly. Strange symbols like öüäü€$ will be spoken.
Solution:
Change the encoding of the source files(e.g: Source.cpp) into UTF-16LE WITH BOM