5 ms·
JSON is not always guaranteed to be UTF-8. It wasn't updated to mandate that until 2017 https://www.tbray.org/ongoing/When/201x/2017/12/14/RFC-8259-STD-90 https
by steveklabnik 7y ago
JSON is not always guaranteed to be UTF-8. It wasn't updated to mandate that until 2017 https://www.tbray.org/ongoing/When/201x/2017/12/14/RFC-8259-STD-90 https://www.tbray.org/ongoing/When/201x/2017/12/14/RFC-8259-...
That said, I certainly hope that it is, generally speaking.
- tracker1 7y agoThe original spec said UTF-8/16/32, but unaware of any reference implementation that used anything other than UTF-8 ... though, who knows with hand rolled crap, and windows in the mix.
- Vendan 7y agohttps://tc39.es/ecma262/#sec-json.stringify https://tc39.es/ecma262/#sec-json.stringify The stringify function returns a String in UTF-16 encoded JSON format representing an ECMAScript value, or undefined.
- masklinn 7y agoPython's `json` returns text, which you can encode however you want.