Unicode is cool. But converting from or to something else is &#@à'$£ cool :-(
Sometimes you need to convert from UNICODE to ANSI or ASCII or OEM or (add here what you want like UTF-x or Mac stuff) ....
So all functions we can use :
If you are reading in
Strings overviews in MSDN you don't thing there is something else ...
The funny part is somewhere else ....
In a little program with all UNICODE stuff ready try this:
LPCWSTR p = L"hello world éèçàêôî";
And the result is :
result1 => "hello world ‚Ї…ˆ“Œ"
result2 => "hello world éèçàêôî"
Well it's not the same, I thing wsprintfA %S doesn't use CharToOem it's obvious ...
There is someting else somewhere ....
try
Unicode and Character Set FunctionsBingo,
WideCharToMultiByte seem attractive. Let's try .....
char result3[MAX_PATH];<BR> WideCharToMultiByte( CP_ACP, 0, p, -1, result3, MAX_PATH, NULL, NULL );<BR>
Yes that's it, result3 => "hello world éèçàêôî"
Conclusion :
OEM and ANSI are not the same and windows documentation is not always very clear :-)