Re: How to print unicode like: こ ん に ち は 世界

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu May 19 13:37:13 PDT 2011


If you're on Windows, you need to set the proper codepage for the
console, you can do it programmatically like so:

version(Windows)
{
   import std.c.windows.windows;
   extern(Windows) BOOL SetConsoleOutputCP(UINT);
}

void main()
{
   version(Windows) SetConsoleOutputCP(65001);
   writeln("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界");
}

You would also need a Unicode-aware font, maybe Lucida or something
similar. Typically fixed-point fonts used for programming have little
support for Unicode characters, and you would get back a black or
white box like "[]".


On 5/19/11, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> Which OS?
>


More information about the Digitalmars-d-learn mailing list