News for hackers. Stuff that matters.
Re:JavaScript’s internal character encoding: UCS-2 or UTF-16? by finnw on Friday January 20, 2012 @12:29PM (#3490261)
Not quite. Surrogates (http://stackoverflow.com/q/5178202/12048) are UTF-16 code units but they are not UCS-2 code units.
Re:JavaScript’s internal character encoding: UCS-2 or UTF-16? by mathias on Friday January 20, 2012 @12:54PM (#3490381)
This.

JavaScript’s internal encoding is closer to UCS-2 than it is to UTF-16, but it doesn’t guarantee that a string is valid UCS-2 (or valid UTF-16).