问题描述
似乎JSON默认编码为UTF-8,Spring MVC默认返回application/json; charset=utf-8
,这很难更改.
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.
推荐答案
根据 RFC 4627
继续描述如何检测不同的UTF- *编码,这表明不支持其他编码.
It goes on to describe how the different UTF-* encoding are to be detecting, suggesting that no other encodings are supported.
此处的"SHALL"表示绝对要求(请参见 RFC 2119 ).
"SHALL" represents an absolute requirement here (see RFC 2119).
确实没有理由将非UTF编码与JSON一起使用(因为任何可以处理JSON的东西都可以绝对处理UTF-8).
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).
这篇关于JSON使用哪种内容类型标头? " application/json; charset = utf-8"或"application/json"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!