Advertising

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: nob...@puremagic.com
ReportedBy: acehr...@yahoo.com
--- Comment #0 from Ali Cehreli <acehr...@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: -------