How to write asia characters on console?

weaselcat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 7 22:05:29 PST 2015


On Sunday, 8 February 2015 at 05:57:31 UTC, Lave Zhang wrote:
> Hi,
>
> My first D program is like this:
> -----------------------------------
> import std.stdio;
>
> void main(string[] args)
> {
>       dstring s1 = "hello你好"d;
>       writeln(s1);
> }
> -----------------------------------
> But the output is not correct(and my console codepage is 936):
>
> C:\D\dmd2\samples\d>dmd hello.d -offilename hello.exe
> C:\D\dmd2\samples\d>hello.exe
> hello浣犲ソ
>
> thanks.

Hi,
I tried your code and it works fine for me. I think the windows 
console only supports UTF-16, try using wchar/wstring instead of 
dchar/dstring.


More information about the Digitalmars-d-learn mailing list