Does JSON only support Unicode? It doesn't seem like encoding matters if this is the case. Won't all JSON then be unicode, and the Charset just a matter of storage?
2 Answers
From the RFC, "JSON text SHALL be encoded in Unicode." Unicode is really a character set, not an encoding, though. It also says the "default encoding is UTF-8." The same section explains how to distinguish between UTF-32BE, UTF-16BE, UTF-32LE, UTF-16LE, and UTF-8 based on the pattern of nulls.
In summary, use UTF-8 unless you have a strong reason to do otherwise. However, you can use a different Unicode encoding.
2 Comments
Matthew Flaschen
@Stephen, thanks for the correction. I thought (incorrectly) that SHALL was equivalent to SHOULD. You're right that it's actually equivalent to MUST.
Matthew Flaschen
@Stephen, yes, I was aware of that RFC. But I didn't check it before answering. :)