Everybody hates UTF-16 :)
What JohnL suggests is exactly what I do in my code - keep everything UTF8 so its cross platform and I can store everything in char array. Just before passing strings to Windows I convert them:
| char *src = ...;
WCHAR dst[MAX_PATH];
MultiByteToWideChar(CP_UTF8, 0, src, -1 /* or strlen(src) if known */, dst, MAX_PATH-1);
CreateFileW(dst, ...)
|
And WideCharToMultiByte for converting other way around - when I get UTF-16 string from Windows and need to convert UTF-8.
I found this is easiest way how to use Unicode API in Windows C/C++ code. All that TCHAR and _("...") define's are terrible.
In non US countries a lot of people use Windows in their native locale. On such machines it is very probable that either username won't be represented in ANSI encoding (C:\Users\āņšāģ\...) or "C:\Program Files" will have weird name. Or some other problem will happen where you can not open files using WinAPI *A functions.