TDPL: Foreach over Unicode string

Walter Bright newshound2 at digitalmars.com
Fri Jul 30 14:39:23 PDT 2010


Sean Kelly wrote:
> Walter Bright <newshound2 at digitalmars.com> wrote:
>> Kagamin wrote:
>>> Walter Bright Wrote:
>>>>> When writing characters out to Windows, though, you have to be
>>>>> careful what >> "code page" Windows thinks your app is running
>>>>> in.
>>>> It's valid for char functions.
>>> Is it valid that wide functions don't work either?
>> The wide functions are supposed to be utf16, and those should work.
> 
> Surprisingly, they don't appear to work properly. The locale used for
> the UTF16 to multibyte conversion is the currently set locale, and that
> prints garbage on my Windows install. I had to use the OEM locale for it
> to work. I was going to fix this but wasn't sure if std.stdio should be
> setting the codepage it requires, or if the DMC code is broken (which
> doesn't seem likely).

The D functions are supposed to send UTF16 to Windows via the "W" interface. 
What Windows does with it is up to Windows. The functions are NOT supposed to do 
a multibyte conversion and send it to the Windows "A" interface, except for the 
Win9x versions.


More information about the Digitalmars-d mailing list