Is it necessary to use Windows Wide Features, or can I do everything now with Unicode and UTF-8?
Yes. Unfortunately, Windows does not have native support for UTF-8. If you need proper Unicode support, you need to use the wchar_t version of the Windows API functions, not the char version.
Should TCHAR be excluded from Windows code?
Yes you need. The reason for TCHAR is to support both Unicode and non-Unicode versions of Windows. Non-Unicode support may have been a major issue back in 2001, when Windows 98 was still popular, but not today.
And it is unlikely that any Windows-independent library would have the same char / wchar_t overload that uses TCHAR .
So go ahead and replace all your TCHAR with wchar_t s.
The code compiles on Unix / Mac with GCC and cross-compilers for Windows with MinGW.
I used to have to write cross-platform C ++ code. (Now my job is to write cross-platform code in C #.) Character encoding is rather painful when Windows does not support UTF-8 and Un * x does not support UTF-16. In the end, I used UTF-8 as our main encoding and conversion as needed on Windows.
dan04
source share