On 2012-03-31 17:56, Jacob Carlborg wrote:
How would I read a unicode character from the terminal? I've tried using
"std.cstream.din.getc" but it seems to only work for ascii characters.
If I try to read and print something that isn't ascii, it just prints a
question mark.
I solved it like this:
dchar readChar ()
{
char[4] buffer;
buffer[0] = din.getc();
auto len = codeLength!(char)(buffer[0]);
foreach (i ; 1 .. len)
buffer[i] = din.getc();
size_t i;
return decode(buffer, i);
}
--
/Jacob Carlborg