JSON's official specification says:
JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32. The default encoding is UTF-8, and...
So, essentially the JSON message can come in any of those three encodings. But... how do I guess which one is it when I receive it?
The message can come from multiple sources, such as a queue, from the browser, from the database, the file system, etc.
It also says to ignore Byte Order Masks (BOM):
...implementations that parse JSON texts MAY ignore the presence of a byte order mark rather than treating it as an error.
I remember XML docs had a "prolog" that specified the encoding, but I can't find anything similar for JSON messages.
Any ideas?