It seems that the JSON default encoding is UTF-8 and Spring MVC returns application/json; charset=utf-8
by default, which is hard to change.
16
votes
2 Answers
20
votes
According to RFC 4627
JSON text SHALL be encoded in Unicode. The default encoding is UTF-8.
It goes on to describe how the different UTF-* encoding are to be detecting, suggesting that no other encodings are supported.
"SHALL" represents an absolute requirement here (see RFC 2119).
And there really is no reason to use a non-UTF encoding with JSON (as anything that can handle JSON can definitely handle UTF-8).
0
votes
Returning a charset parameter on application/json is incorrect, as that media type does not define a charset parametert. See https://greenbytes.de/tech/webdav/rfc8259.html#rfc.section.11, last sentence:
Note: No "charset" parameter is defined for this registration. Adding one really has no effect on compliant recipients.