[Issue 5743] New: readf cannot read wchar or dchar from UTF-8 stdin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 16 13:24:07 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5743

           Summary: readf cannot read wchar or dchar from UTF-8 stdin
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: acehreli at yahoo.com


--- Comment #0 from Ali Cehreli <acehreli at yahoo.com> 2011-03-16 13:20:54 PDT ---
I compiled the following program with dmd 2.052 on an Ubuntu 10.10 console.

The following program reads only the first code unit instead of the whole
character.

import std.stdio;

void main()
{
    wchar c;         // Please note: same problem with dchar as well
    readf(" %s", &c);
    writeln(c);
}

For example when the input is the character ö (encoded with byte values 195 182
in UTF-8), only the first code unit is read and the output becomes the Unicode
character that corresponds to the value of that code unit.

In a sense, the program reads a code unit and outputs it as a code point.

Thank you,
Ali

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


More information about the Digitalmars-d-bugs mailing list