Also keep in mind that the native string type in JavaScript is UCS-16 which means that any code points higher than 16 bits have to be encoded using surrogate pairs. (Note that the native encoding is quite different from the UTF-8 encoding commonly used when serializing strings to binary data)
A quick way to check your terminal's settings is to read stdin as node buffers and inspect the bytes manually. UTF-8 isn't too hard to recognize and decode by hand for just a few chars. On Fri, Oct 25, 2013 at 4:08 AM, greelgorke <greelgo...@gmail.com> wrote: > it depends on how your terminal is configured. on mac osX for example you > can choose wich character encoding should be used. > > Am Freitag, 25. Oktober 2013 04:02:44 UTC+2 schrieb yougen zhuang: >> >> I write some Chinese character into the stdin, isn't it valid utf8? >> >> >> 2013/10/24 mscdex <msc...@gmail.com> >> >>> On Wednesday, October 23, 2013 11:35:51 PM UTC-4, yougen zhuang wrote: >>>> >>>> Even setting ReadableStream.setEncoding('**ut**f8'), node still can't >>>> show Chinese or other chareacters. >>>> >>>> >>> Are you sure the text is (valid) utf-8 and not some other character set? >>> >>> -- >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-* >>> *Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines> >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to nod...@googlegroups.com >>> >>> To unsubscribe from this group, send email to >>> nodejs+un...@**googlegroups.com >>> >>> For more options, visit this group at >>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en> >>> >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "nodejs" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/** >>> topic/nodejs/N_681AM3bXQ/**unsubscribe<https://groups.google.com/d/topic/nodejs/N_681AM3bXQ/unsubscribe> >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> nodejs+un...@**googlegroups.com. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >> >> -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.