2.067 should modify writeln function, make it display correctly ANSI characters in CMD. Exe

FrankLike via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 25 08:33:50 PST 2015


On Sunday, 25 January 2015 at 16:22:20 UTC, AndyC wrote:
> On Sunday, 25 January 2015 at 16:09:59 UTC, FrankLike wrote:
>> Many people want to display their string(ANSI),but always to 
>> convert string by
>>
>> 'toMBSz',and it can't convert to immutable char[],it's 
>> difficult to display their ANSI
>>
>> string in CMD.EXE.
>>
>>
>> What do you think?
>
> But .. some people switch cmd.exe to utf8, so you'll break them.
>
> http://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8
>
> not to mention all the linux people it'll break.
>
> Perhaps:
>
> import std.windows.charset;
> import std.conv;
>
> then:
>
> writeln(to!(string)(toMBSz(utf8)));

Why not switch by Version:
version(Windows)
{
    writeln(to!(string)(toMBSz(utf8)));
}
else version(linux)
{
   ...
}



More information about the Digitalmars-d mailing list