[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Walter Bright changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=24001 --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Iain Buclaw changed: What|Removed |Added Priority|P2 |P3 --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 --- Comment #19 from RazvanN --- (In reply to kinke from comment #18) > This isn't solved, but would now be solvable with recent Windows versions. > > There are 2 things about this: > * DMD outputs a mix of UTF-8 and strings in the current codepage, AFAIK > without setting any console codepage, so DMD output on Windows can be > garbage. LDC v1.17 fixes this for LDC. How does LDC solve the problem? > * User programs writing UTF-8 strings to the console suffer from the same > issue. This *could* be worked around by setting the console codepage in > druntime's _d_run_main and resetting it to the original one before > termination. --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 --- Comment #18 from kinke --- This isn't solved, but would now be solvable with recent Windows versions. There are 2 things about this: * DMD outputs a mix of UTF-8 and strings in the current codepage, AFAIK without setting any console codepage, so DMD output on Windows can be garbage. LDC v1.17 fixes this for LDC. * User programs writing UTF-8 strings to the console suffer from the same issue. This *could* be worked around by setting the console codepage in druntime's _d_run_main and resetting it to the original one before termination. --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #17 from RazvanN --- (In reply to kinke from comment #16) > Update: it's working with Win10 v1903 (with the exact same binary that > didn't work with v1803). According to Rainer Schütze, it's working since > v1809. See > https://devblogs.microsoft.com/commandline/windows-command-line-unicode-and- > utf-8-output-text-buffer/. So is this issue fixed? I don't have a windows machine to test it. Should we close this? --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 --- Comment #16 from kinke --- Update: it's working with Win10 v1903 (with the exact same binary that didn't work with v1803). According to Rainer Schütze, it's working since v1809. See https://devblogs.microsoft.com/commandline/windows-command-line-unicode-and-utf-8-output-text-buffer/. --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 ki...@gmx.net changed: What|Removed |Added CC||ki...@gmx.net --- Comment #15 from ki...@gmx.net --- Still an issue, but apparently restricted to stderr (and independent from DigitalMars/MS runtime): ``` import core.stdc.stdio; import core.sys.windows.wincon, core.sys.windows.winnls; void main() { const oldCP = SetConsoleOutputCP(CP_UTF8); scope(exit) SetConsoleOutputCP(oldCP); fprintf(stdout, "HellöѬ LDC\n"); fflush(stdout); fprintf(stderr, "HellöѬ LDC\n"); fflush(stderr); } ``` => ``` HellöѬ LDC Hell ``` Tested with DMD 2.086.0 (-m32, -m32mscoff, -m64) and LDC on Win10. --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 --- Comment #14 from Martin Krejcirik --- Partial fix or workaround in druntime for unhandled exceptions: https://github.com/dlang/druntime/pull/1687 --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Martin Krejcirik changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=15761 --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Martin Krejcirik changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=15845 --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 --- Comment #13 from Martin Krejcirik --- Final note, as this is unlikely to be fixed: use -m32mscoff and Microsoft VS linker. --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Sum Proxy changed: What|Removed |Added CC||sum.pr...@gmail.com Hardware|x86_64 |x86 --- Comment #12 from Sum Proxy --- The issue still exists in DMD32 D Compiler v2.065, Windows 7 == Code: == import std.stdio; import std.c.windows.windows; extern(Windows) BOOL SetConsoleOutputCP( UINT ); void main() { SetConsoleOutputCP( 65001 ); // or use "chcp 65001" instead stderr.write("STDERR:Output utf-8 accented char \u00e9\n... and the rest is cut off!\n"); stderr.write("end_STDERR.\n"); } == Output: == STDERR:Output utf-8 accented char é ... and the rest is cut off! == end_STDERR.\n is not written --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Vladimir Panteleev changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12990 --
[Issue 1448] UTF-8 output to console is seriously broken
https://issues.dlang.org/show_bug.cgi?id=1448 Vladimir Panteleev changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=2742 --
[Issue 1448] UTF-8 output to console is seriously broken
https://d.puremagic.com/issues/show_bug.cgi?id=1448 --- Comment #11 from Martin Krejcirik 2014-02-25 02:18:25 CET --- Hallelujah, this (comment 8) seems fixed, finally. Can anybody confirm ? Works for me on Windows XP 32 bit, dmd 2.065.0 Beware, fputs still doesn't work. I think it's C library problem. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1448] UTF-8 output to console is seriously broken
http://d.puremagic.com/issues/show_bug.cgi?id=1448 --- Comment #10 from Axel Bender 2013-08-07 00:58:06 PDT --- Addendum: Windows 7 64-bit, dmd v2.063.2. Sorry. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1448] UTF-8 output to console is seriously broken
http://d.puremagic.com/issues/show_bug.cgi?id=1448 Axel Bender changed: What|Removed |Added CC||b...@world-of-ben.de Platform|x86 |x86_64 Version|D1 & D2 |D2 --- Comment #9 from Axel Bender 2013-08-07 00:55:43 PDT --- I can confirm this issue. When enumerating a directory (via dirEntries()) containing a file with a character in the CP850/CP1252 space (e.g. "s�b"), depending on the codepage settings, the output is as follows: chcp 1252 => output is "säb" (Unicode encoding for "�") chcp 65001 => output is "s�bstd.exception.ErrnoException@D:\tools\d\bin\..\src\phobos\std\stdio.d(1352): (No error)" In both cases e.g. cmd's dir shows the correct results. The correct results are also shown when using - not really comparable - C with printf(). Tried the case in cmd, console2, and conemu. All show the same results. It'd really be nice if this bug would get fixed... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1448] UTF-8 output to console is seriously broken
http://d.puremagic.com/issues/show_bug.cgi?id=1448 Martin Krejcirik changed: What|Removed |Added Version|1.020 |D1 & D2 --- Comment #8 from Martin Krejcirik 2013-03-19 18:21:18 PDT --- Status update as of DMD 2.062 (Win XP 32 bit) Still the same error for the above mentioned example, however, when modified to use write instead of fputs: import std.stdio; import std.c.windows.windows; extern(Windows) BOOL SetConsoleOutputCP( UINT ); void main() { SetConsoleOutputCP( 65001 ); // or use "chcp 65001" instead stderr.write("STDERR:Output utf-8 accented char \u00e9\n... and the rest is cut off!\n"); stderr.write("end_STDERR.\n"); } I get this error: STDERR:Output utf-8 accented char � ... and the rest is cut off! std.exception.ErrnoException@D:\PROGRAMS\DMD2\WINDOWS\BIN\..\..\src\phobos\std\stdio.d(1264): (No error) 0x0040D874 0x0040D6FF 0x00402218 0x00402189 0x00402121 0x00402030 0x0040354E 0x00403151 0x00402388 0x7C81776F in RegisterWaitForInputIdle So if anybody have a clue what's going on there... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1448] UTF-8 output to console is seriously broken
http://d.puremagic.com/issues/show_bug.cgi?id=1448 Kevin changed: What|Removed |Added CC||ke...@brogan.ca --- Comment #7 from Kevin 2012-02-07 22:48:48 PST --- Sort of works for me. The text doesn't get cut off, but the unicode characters don't get displayed either. C:\Users\Kevin\Documents\D Projects\ConsoleApp1\ConsoleApp1\bin>ConsoleApp1.exe Output utf-8 accented char é ... and the rest is OK Output utf-8 accented char �� ... and the rest is cut off! STDOUT. STDERR. C:\Users\Kevin\Documents\D Projects\ConsoleApp1\ConsoleApp1\bin> -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---