www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3347] New: std.stdio.writeln attempts to print illegal unicode characters

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347

           Summary: std.stdio.writeln attempts to print illegal unicode
                    characters
           Product: D
           Version: 2.034
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla digitalmars.com


--- Comment #0 from Walter Bright <bugzilla digitalmars.com> 2009-09-26
14:55:59 PDT ---
The following program:

import std.stdio;
import std.c.stdio;

void main()
{
    dchar d;
    printf("%x\n", d);
    writeln(d);
}

correctly shows that d is initialized to \uFFFF, an illegal Unicode character,
but writeln attempts to print it anyway as a character.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com


--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com> 2009-09-26
17:05:52 PDT ---
Should writeln throw here?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com


--- Comment #2 from Stewart Gordon <smjg iname.com> 2009-09-26 18:28:52 PDT ---
What are the rules about valid uses of the permanently unassigned codepoints
U+FFFE and U+FFFF?  ISTM while it doesn't make sense to write either to stdout,
it would be valid to send one, for example, to a MemoryStream for the app's
internal use.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 26 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347



--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2009-09-27
20:21:35 PDT ---
I don't know what the right answer is, but it has come up and I think it
deserves to be an issue. I propose we let it cook for a while and see if anyone
comes up with a compelling argument for what the correct behavior should be.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 27 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347



--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2009-10-05
15:05:51 PDT ---
Yeah, I think it would probably be a mistake for writeln to throw.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347


Andrei Alexandrescu <andrei metalanguage.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3347


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |WONTFIX


--- Comment #5 from Andrei Alexandrescu <andrei metalanguage.com> 2011-01-16
14:09:10 PST ---
I'm closing this now. Upon further experience, it seems fair to check for
Unicode validity in upper layers and leave writeln to write invalid characters
on a best-effort basis. If there are solid arguments to the contrary and good
alternative ideas, please reopen.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 16 2011