• 请不要在回答技术问题时复制粘贴 AI 生成的内容
hujianxin
V2EX  ›  程序员

Content-Type: application/json; charset=utf-8,里面这个 charset 是协议规定的吗?

  •  
  •   hujianxin · Feb 15, 2019 · 7561 views
    This topic created in 2818 days ago, the information mentioned may be changed or developed.

    在使用 java 的 http 框架发送 put 请求时,content type 设为 application/json,但是实际发送的是 application/json; charset=utf-8。

    请教各位大佬,这是一种规范吗?还是一种规定呢?

    4 replies  •  2019-02-15 13:40:33 +08:00
    leoleoasd
    leoleoasd
    Feb 15, 2019
    1
    rfc 里写的吧
    xj577
    xj577
    Feb 15, 2019
    2
    感觉是一种兼容性需求而非硬性规定要求,搜了下关于 media type 和 application/json 的 rfc,并没有规定在 json 的 content-type 里设定 charset。
    RFC8259: No "charset" parameter is defined for this registration. Adding one really has no effect on compliant recipients.
    hujianxin
    hujianxin
    OP
    Feb 15, 2019
    3
    @xj577 多谢
    hilbertz
    hilbertz
    Feb 15, 2019
    4
    http 就是这么啰嗦的,实际没啥用处
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1313 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:05 · PVG 05:05 · LAX 13:05 · JFK 16:05
    ♥ Do have faith in what you're doing.