---- import std.stdio; void main() { // converting to char { auto f = File("test.txt", "w"); f.writeln("\U0001F608"w); // UTFException } // converting to wchar_t { auto f = File("test.txt", "w,ccs=UTF16LE"); // from char f.writeln("ΓΆ"); // writes garbage f.writeln("\U0001F608"); // ditto // from wchar f.writeln("\U0001F608"w); // leads to ErrnoException } } ---- PR follows.
(In reply to ag0aep6g from comment #0) > PR follows. https://github.com/dlang/phobos/pull/6469
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/d5cc4c5087a1819ac716cb5ea11d988fa667f822 fix conversion from wchar to char in LockingTextWriter.put Fixes the easier part of issue 18789.
@aG0aep6G updated dlang/phobos pull request #6469 "[WIP] fix issue 18789 - std.stdio messes up UTF conversions on output" mentioning this issue: - fix conversion from wchar to wchar_t in LockingTextWriter.put This fixes issue 18789. https://github.com/dlang/phobos/pull/6469
dlang/phobos pull request #6469 "fix issue 18789 - std.stdio messes up UTF conversions on output" was merged into master: - 41f78fc1e111323a5097a2f96d8e232cb27e01d1 by aG0aep6G: fix conversion from wchar to wchar_t in LockingTextWriter.put This fixes issue 18789. - e7e75cf2343bee5bae24622ef8035cde159b6c52 by aG0aep6G: add the original test case of issue 18789 ... to ensure that it doesn't throw any exceptions like it used to. https://github.com/dlang/phobos/pull/6469
(In reply to Dlang Bot from comment #4) > This fixes issue 18789. Not sure why the bot didn't pick that up. Closing as fixed.