Messy code in console

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 11 04:21:41 PDT 2014


On Sunday, 11 May 2014 at 08:48:43 UTC, FreeSlave wrote:
> On Sunday, 11 May 2014 at 07:43:07 UTC, Kagamin wrote:
>> Known bug https://issues.dlang.org/show_bug.cgi?id=2742
>
> It's not bug. Write-functions are designed to output text to 
> stdout, and it's issue of programmer to make sure that expected 
> "acceptor" can interpret them properly. Note that stdout may be 
> redirected to file or be part of pipe, that does nothing with 
> cmd console.

OK, just tested it: after a program calls 
SetConsoleOutputCP(CP_UTF8); it's able to print utf-8 text 
correctly, but if it fails to reset the codepage back, the 
console remains in utf-8, so other programs will fail to print 
text in oem encoding in such console. If this program runs other 
programs, they fail to print oem text to this console, because 
the console expects utf-8.


More information about the Digitalmars-d-learn mailing list