Jump to page: 1 2
Thread overview
[Issue 2742] New: std.stdio assumes console works in utf-8
Mar 18, 2009
d-bugmail
Mar 30, 2009
d-bugmail
Mar 30, 2009
d-bugmail
Jul 28, 2010
Stewart Gordon
Sep 26, 2010
Stewart Gordon
Sep 29, 2010
Sobirari Muhomori
Sep 29, 2010
Sobirari Muhomori
Sep 29, 2010
Sobirari Muhomori
May 25, 2011
Andrej Mitrovic
May 25, 2011
Stewart Gordon
May 25, 2011
Vladimir Panteleev
May 26, 2011
Andrej Mitrovic
Jan 23, 2012
Walter Bright
March 18, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2742

           Summary: std.stdio assumes console works in utf-8
           Product: D
           Version: 2.025
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: maxmo@pochta.ru


This is wrong on Windows. One *can* set console codepage to utf8 and font to Lucida Console, though this is unusual configuration and console programs can't work out of the box. This leaves std.stdio useless. As far as I know, this applies also to Phobos1. If this is not going to be fixed, it should be documented.


-- 

March 30, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2742





------- Comment #1 from smjg@iname.com  2009-03-30 04:40 -------
There was a brief discussion on this
http://tinyurl.com/c789py
but it was inconclusive.

Meanwhile, check out http://pr.stewartsplace.org.uk/d/sutil/


-- 

March 30, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2742





------- Comment #2 from maxmo@pochta.ru  2009-03-30 06:17 -------
>But how many DOS or Windows console apps in the real world output UTF-8? Presumably not many, considering that no versions of DOS and only a few versions of Windows support it.  There's also a causal loop in that even modern Windows versions don't come with the console code page set to 65001 by default.  I don't know what is likely to break this loop, but I doubt that the restrictiveness of one language's standard library is going to do it.
There is PoshConsole http://poshconsole.codeplex.com/
It's all .net and WPF, therefore UTF-16, but it's way different architecture
and interface.
BTW cmd has /u switch for (redirected) unicode output, I use it sometimes.


-- 

October 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2742


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2742


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #3 from Stewart Gordon <smjg@iname.com> 2010-07-28 10:42:40 PDT ---
*** Issue 4522 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2742



--- Comment #4 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-09-26 14:24:54 PDT ---
Any fresh ideas on how to fix this?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2742



--- Comment #5 from Stewart Gordon <smjg@iname.com> 2010-09-26 16:01:10 PDT ---
I suppose the way to go about it is to create wrapper stream classes that provide encoding conversion.  And have ready-made instances for stdin/out/err, with the codepage detected at launch.

The difficulty I can see is seekability, but this probably isn't needed given that it'll be primarily for stdio (which are inherently not seekable) and text files (for which seeking isn't particularly useful).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2742



--- Comment #6 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2010-09-29 10:58:53 PDT ---
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=114211

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2742



--- Comment #7 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2010-09-29 11:02:43 PDT ---
This can be a good test for dchar[]-looking ranges.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2742



--- Comment #8 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2010-09-29 11:39:42 PDT ---
Looking at std.stdio, an easy fix will be to make sure all IO goes through File.write, which calls LockingTextWriter.put, which actually tries to do the correct transcoding. You just need to have target codepage in File, and use it in LockingTextWriter.put. The first thing is to statically import core.stdc.stdio to minimize and control its usage.

Though a nice design will be correctly implemented .net-way Streams/TextStreams, whatever you want them to work like in D.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2