std.locale

Sergey Gromov snake.scaly at gmail.com
Mon Mar 2 14:32:32 PST 2009


Mon, 02 Mar 2009 12:53:48 -0800, Andrei Alexandrescu wrote:

> Rainer Deyke wrote:
>> Sergey Gromov wrote:
>>> To actually solve this problem the default exception handler must be
>>> fixed to convert any UTF-8 into the current OEM code page before
>>> printing.  It would also help if default stdin and stdout performed such
>>> a conversion.
>> 
>> No, stdin/stdout *must* perform this conversion.  It is a serious bug if
>> they don't.
>> 
>> The conversion cannot be performed at any other level.  D uses unicode
>> internally.  The console uses a specific encoding.  Therefore all data
>> passing between D and the console must be encoded/decoded.
>> 
> 
> What API to use to detect the encoding used by the console?

There is std.windows.charset.toMBSz(str, 1) which does the right thing.



More information about the Digitalmars-d mailing list