相关疑难解决方法(0)

charset参数可以与http/1.1中的application/json内容类型一起使用吗?

例如,它是有效的ajax请求:

$.ajax({
    type: "POST",
    url: "SomePage.aspx/GetSomeObjects",
    contentType: "application/json; charset=utf-8",
    ...
});
Run Code Online (Sandbox Code Playgroud)

有时用作示例,或者软件可以在没有显式字符集的情况下中断.

应用程序/ json媒体类型的rfc 4627表示它不接受第6节中的任何参数:

The MIME media type for JSON text is application/json.

Type name: application

Subtype name: json

Required parameters: n/a

Optional parameters: n/a
Run Code Online (Sandbox Code Playgroud)

可以解释为charset不应该与application/json一起使用.

第3节表明,这是没有必要指定字符集:

JSON text SHALL be encoded in Unicode.  The default encoding is
UTF-8.

Since the first two characters of a JSON text will always be ASCII
characters [RFC0020], it is possible to determine whether …
Run Code Online (Sandbox Code Playgroud)

json http character-encoding

13
推荐指数
2
解决办法
7987
查看次数

标签 统计

character-encoding ×1

http ×1

json ×1