_wsetlocale doesn't support Unicode-only locales

by Michael S. Kaplan, published on 2007/04/29 14:51 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/04/29/2328012.aspx


There are many people who are writing code in C/C++ who try to use the more portable CRT functions rather than the Win32 ones.

Since in many cases the CRT functions actually wrap the Win32 functions when you run on Windows anyway, this approach allows for more portable code if you do ever want to run on other platforms.

This does not always work, though.

I was talking to Ale Contenti over on the C++ team just the other day and one of the things we talked about was the fact that the locale support sitting underneath setlocale and _wsetlocale was not stored in a Unicode encoding, which is why even though there is a _wsetlocale function which clearly provides a Unicode interface to the locales, that the locales that are in fact set will not be Unicode.

This is why the language strings that _wsetlocale supports do not include any of the Unicode only languages, and why if you try to load them anyway via their three-letter windows code you can expect a lot of question marks in your future if you try to use the data that the locale provides....

In the end, the interface is not the most important part -- the underlying support is. So for now you'll have to stick to Win32 if you want all of the locales that the OS can support....

 

This post brought to you by (U+0d0f, a.k.a. MALAYALAM LETTER EE)


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2008/05/02 More things that don't work for locales in the CRT

go to newer or older post, or back to index or month or day