www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14129] New: stdio.write crashed on window console with

https://issues.dlang.org/show_bug.cgi?id=14129

          Issue ID: 14129
           Summary: stdio.write crashed on window console with codepage
                    65001
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: mzfhhhh foxmail.com

Created attachment 1474
  --> https://issues.dlang.org/attachment.cgi?id=1474&action=edit
test.json

windows console default codepage is 936,
it's show chinese char is uncorrect.
so i input the command "chcp 65001" change the codepage .
then in most cases,it's works ok!

but write a special file,it's crashed.
--------------------
import std.stdio;
import std.file;

int main(string[] argv)
{  
    auto s = readText(r".\test.json");
    write(s);   //crashed

    return 0;
}

std.exception.ErrnoException C:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(2113):
 (No error)
----------------
0x00402998
0x00402901
0x00402897
0x00402881
0x004027AA
0x004040B3
0x00403FC9
0x00402AF3
0x776C1194 in BaseThreadInitThunk
0x779AB3F5 in RtlInitializeExceptionChain
0x779AB3C8 in RtlInitializeExceptionChain
Failed to flush stdout: No error

--
Feb 05 2015