Jump to page: 1 2
Thread overview
[Issue 13651] Writing Unicode text with console code page 65001 (UTF-8) may fail
Oct 25, 2014
Vladimir Panteleev
Oct 27, 2014
Sobirari Muhomori
Oct 27, 2014
Sobirari Muhomori
Oct 27, 2014
Vladimir Panteleev
Oct 27, 2014
Vladimir Panteleev
Oct 27, 2014
Sobirari Muhomori
Oct 27, 2014
Sobirari Muhomori
Oct 27, 2014
brocolis
Nov 01, 2016
Martin Krejcirik
Sep 20, 2018
Jan Jurzitza
Mar 24, 2021
Berni44
Dec 17, 2022
Iain Buclaw
October 25, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
BTW, I've tried reducing data.txt, and I think it's no coincidence that its size is 1 past 16384 (0x4000).

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #2 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
Is "broken pipe" error reported by MSVC runtime itself? The file interface to console stream in utf-8 encoding is a little tricky: the program shouldn't check the number of written bytes (it's probably messed by transcoding).

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #3 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
(In reply to Vladimir Panteleev from comment #1)
> BTW, I've tried reducing data.txt, and I think it's no coincidence that its size is 1 past 16384 (0x4000).

You mean it works for smaller files? There's size limit for string written to console: https://connect.microsoft.com/VisualStudio/feedback/details/635230/

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #4 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Yes.

The program I posted throws an exception because fwrite returns a number (bytes written) smaller than the size of the data. According to its documentation, this indicates a write error.

I've tried modifying std.stdio to retry incomplete fwrites with the remaining data segment, but although now no exception is thrown, the output is corrupted (some data is repeated).

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> ---
I guess sometimes fwrite will return a number different from the "count" parameter, even though it wrote everything without an error?

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #6 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
I think, it applies to console only. By implementation, WriteFile checks if the file is console and calls WriteConsoleA, which can think in characters instead of bytes.

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

--- Comment #7 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
Indeed, docs for WriteConsole say it operates in terms of characters without definition of the character and indeed it reports the number of written characters, not bytes.

--
October 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13651

brocolis <brocolis@eml.cc> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brocolis@eml.cc

--- Comment #8 from brocolis <brocolis@eml.cc> ---
FYI there's a similar problem with the curl command line tool with chcp 65001.

chcp 65001
curl https://issues.dlang.org/attachment.cgi?id=1447
curl: (23) Failed writing body (3019 != 8000)

--
February 06, 2015
https://issues.dlang.org/show_bug.cgi?id=13651

mzfhhhh@foxmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mzfhhhh@foxmail.com

--
November 01, 2016
https://issues.dlang.org/show_bug.cgi?id=13651

Martin Krejcirik <mk@krej.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mk@krej.cz

--
« First   ‹ Prev
1 2