On Saturday, 24 January 2015 at 01:54:32 UTC, mzfhhhh wrote:
thanks,you are right.
window console show chinese char is not right,
so i try to add this code:
"
extern(C) int setlocale(int, char*);
static this()
{
fwide(core.stdc.stdio.stdout, 1);
setlocale(LC_CTYPE, cast(char*)"china");
}
"
it's looks like solve the problem,but caused another problem.
now i use "chcp 65001" command to change the code page and
change the
font to "lucida console".it works correctly!
this way also have problem!
look this bug report:
Issue 13651 - Writing Unicode text with console code page 65001
(UTF-8) may fail
now,i use this code show string on window console:
void write(string s)
{
import std.windows.charset:toMBSz;
printf(toMBSz(s));
}
void writeln(string s)
{
write(s);
printf("\r\n");
}