Hello. Another question re. Unicode, terminals and now C# and wc
. If I write this simple piece of code
int i=0;
foreach(char c in Console.In.ReadToEnd())
{
if(c!='\n') i++;
}
Console.WriteLine("{0}", i);
and input it only the character "€" (3 bytes in utf-8), wc
returns 3 characters (maybe using wint_t, though I haven't checked), but ReadToEnd()
returns 1 (one character). What exactly is the behavior of ReadToEnd
in this case? How do I know what ReadToEnd
is doing behind the scenes?
I'm running xterm initialized with utf-8.en.US, running Ubuntu Linux and Mono.
Thank you.