How to write asia characters on console?

mzfhhhh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 8 06:11:00 PST 2015


>
> Thanks, my problem has been solved:)
> ---------------------------------------
> import std.stdio;
> import core.stdc.wchar_;
>
> extern(C) int setlocale(int, char*);
>
> static this()
> {
>    fwide(core.stdc.stdio.stdout, 1);
>    setlocale(0, cast(char*)"china");
> }
>
> int main(string[] args)
> {
> 	string s1 = "hello你好";
> 	writefln("%s", s1);
> 	return 0;
> }

This solution has a problem, look at this:
http://forum.dlang.org/thread/jfawjvoedsxsznsuejoh@forum.dlang.org#post-tyslcbycorgfaqimldnd:40forum.dlang.org


More information about the Digitalmars-d-learn mailing list