V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
hujianxin
V2EX  ›  程序员

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

  •  
  •   hujianxin · Feb 15, 2019 · 7053 views
    This topic created in 2630 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
        1
    leoleoasd  
       Feb 15, 2019
    rfc 里写的吧
    xj577
        2
    xj577  
       Feb 15, 2019
    感觉是一种兼容性需求而非硬性规定要求,搜了下关于 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
        3
    hujianxin  
    OP
       Feb 15, 2019
    @xj577 多谢
    hilbertz
        4
    hilbertz  
       Feb 15, 2019
    http 就是这么啰嗦的,实际没啥用处
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2747 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 15:39 · PVG 23:39 · LAX 08:39 · JFK 11:39
    ♥ Do have faith in what you're doing.