c# - TextWriter.ReadToEnd vs. Unix wc Command -
Another question again unicode, terminal and now c # and wc
. If I write this simple part of the code
int i = 0; Foreach (Four C.ReadTinds (Courses) {if (c! = '\ N') i ++; } Console.light line ("{0}", i);
and describe it only "" ("3 bytes in UTF-8"), wc
returns 3 letters (maybe using wint_t, though I Not checked), but ReadToEnd ()
return 1 (one character). What is the behavior of ReadToEnd
in this case? How do I know that ReadToEnd
is doing behind the screen?
I am starting xterm with utf-8.en.US, which is running Ubuntu Linux and Mono.
Thank you.
wc
and most unix-like command c four < / Code> The deal with the characters in the context of the data type is usually an unsigned 8 bit integer
wc
reads the bytes with a standard input with just any conversion and determines that there are 3 characters .
.NET has its own four
data type that is a 16 bit signed integer and represents a UTF-16 character The console class has received 3 bytes of input , It has been determined that the console is connected to UTF-8 and converted them into a single UTF-16 euro character.
Comments
Post a Comment