On 07/16/2018 11:30 AM, zhani wrote:
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
?볝굯?ャ걾?
鵝졾?
?덈뀞?섏꽭?
--------------------------------------------------
Try this:
----
import std.stdio: writeln;
import std.exception: enforce;
import core.sys.windows.windows: CP_UTF8, SetConsoleOutputCP;
void main()
{
SetConsoleOutputCP(CP_UTF8).enforce;
writeln("Allo");
writeln("こんにちは");
writeln("你好");
writeln("안녕하세요");
}
----