Accept and Accept-Charset - Which is superior?

前端 未结 5 715
攒了一身酷
攒了一身酷 2020-12-08 04:16

In HTTP you can specify in a request that your client can accept specific content in responses using the accept header, with values such as application/xm

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 05:13

    Firstly, Accept headers can accept parameters, see https://tools.ietf.org/html/rfc7231#section-5.3.2

    All text/* mime-types can accept a charset parameter. http://www.iana.org/assignments/media-types/media-types.xhtml#text

    The Accept-Charset header allows a user-agent to specify the charsets it supports.

    If the Accept-Charset header did not exist, a user-agent would have to specify each charset parameter for each text/* media type it accepted, e.g.

    Accept: text/html;charset=US-ASCII, text/html;charset=UTF-8, text/plain;charset=US-ASCII, text/plain;charset=UTF-8

提交回复
热议问题