Comment on Node's Unicode DragonparentComments−justincormack13yJSON is defined as UTF8, 16 or 32 [1]. The escaped characters are UTF-16 not UCS2. It is unfortunate of JavaScript can't parse it correctly![1] http://www.ietf.org/rfc/rfc4627.txt−kansface13yThis is true of JSON, but its not true of Javascript which gives no fucks about utf16 (or valid surrogate pairs). Its a very strange world where JSON and Javascript have incompatible interpretations of strings.http://mathiasbynens.be/notes/javascript-encoding−gnaritas13yNot really as JSON is not valid JavaScript and requires its own parser. It's based on JavaScript, but it is not JavaScript.−daxelrod13yI was skeptical, but I did some searching, and you appear to be right! The difference seems to come down to string handling:http://timelessrepo.com/json-isnt-a-javascript-subset−gnaritas13yHa, same article where I first learned this.
Comments
JSON is defined as UTF8, 16 or 32 [1]. The escaped characters are UTF-16 not UCS2. It is unfortunate of JavaScript can't parse it correctly!
[1] http://www.ietf.org/rfc/rfc4627.txt
This is true of JSON, but its not true of Javascript which gives no fucks about utf16 (or valid surrogate pairs). Its a very strange world where JSON and Javascript have incompatible interpretations of strings.
http://mathiasbynens.be/notes/javascript-encoding
Not really as JSON is not valid JavaScript and requires its own parser. It's based on JavaScript, but it is not JavaScript.
I was skeptical, but I did some searching, and you appear to be right! The difference seems to come down to string handling:
http://timelessrepo.com/json-isnt-a-javascript-subset
Ha, same article where I first learned this.