CJK problem when using console outputs
zhani
dummy at dummy.org
Mon Jul 16 09:30:22 UTC 2018
howdy :-)
i got some problem about using CJK in windows10 console.
here my code(a code file encoded the utf-8):
--------------------------------------------------
import std.stdio;
/*
static this(){
core.stdc.wchar_.fwide(core.stdc.stdio.stdout, 1);
setlocale(0, cast(char*)"korea");
}*/
void main()
{
writeln("Allo");
writeln("こんにちは"); // C
writeln("你好"); // J
writeln("안녕하세요"); // K
}
--------------------------------------------------
and nice result on windows(cmd and powershell):
--------------------------------------------------
Allo
?볝굯?ャ걾?
鵝졾?
?덈뀞?섏꽭?
--------------------------------------------------
wow, very cool. see, wolrd-wise came here on dmd.
In fact, when i using dmd that older version, i solved this
problem with a cheated a way like this:
--------------------------------------------------
static this(){
core.stdc.wchar_.fwide(core.stdc.stdio.stdout, 1);
setlocale(0, cast(char*)"korea");
}
--------------------------------------------------
but the 'dmd v2.081.1' didnt want this.
i guess, because a core package is invisiable now. yap.
how can i solve this problem using clean a way?
thanks.
More information about the Digitalmars-d-learn
mailing list