"Nick Sabalausky" <a@a.a> wrote in message 
news:igq9u6$1bqu$1...@digitalmars.com...
>
> Step 2 (I had to google this step):
>
> For just the current terminal session: Run "chcp 65001". (Ie "CHange Code 
> Page) Also, you can run "chcp" to just see what codepage you're already 
> set to.
>
> To make it work permanently: Put "chcp 65001" into the registry key 
> "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun"
>

Forget that step 2, that causes "Active code page: 65001" to be sent to 
stdout *every* time system() is invoked. We shouldn't be relying on that. 
*This* is what should be done (and this really should be done in all D 
command line apps - or better yet, put into the runtime):

import std.stdio;

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

void main()
{
    version(Windows) SetConsoleOutputCP(65001);

    writeln("HuG says: Fukken Über Death Terminal");
}

See also: http://d.puremagic.com/issues/show_bug.cgi?id=1448



Reply via email to