www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: acehreli yahoo.com


--- Comment #0 from Ali Cehreli <acehreli 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: -------
Mar 16 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5743


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #1 from Don <clugdbug yahoo.com.au> 2011-03-19 17:14:45 PDT ---
This is marked as 'regression'. What previous version did it work with?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5743


Ali Cehreli <acehreli yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |normal


--- Comment #2 from Ali Cehreli <acehreli yahoo.com> 2011-03-19 17:49:29 PDT ---
"regression" turns out to be my mistake. I just went back more than a dozen dmd
versions and see that std.stdio.readf (or File.readf) is pretty new.

I've been using std.cstream.din, which used to work better than stdio.readf.
Thinking that they must be using the same underlying format functions I thought
that this was a regression.

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