Accept-Charset
takes a number of character sets and includes an optional preference for which one the server should use. The charset is one from the list
of available charsets at IANA "Character Sets" registry. For example UTF-8
.
The charset is separated by commas with an optional quality factor (using a ;q=
) that is
used the clients preference for using this type. The quality factor has a value from 0 to 1 with the higher the number the more preference for that type.
If this header is not included then the client will accept any charset.
The server uses Content-Type
to inform the client what character set it is using.
If the server can't find an acceptable charset to reply with then it should send a 406 (not acceptable) response or ignore this header and not doing any content negotiation.
Request:"http://example.com"
GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: UTF-8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive
The client will accept only UTF-8 char sets.
Request:"http://example.com"
GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: UTF-8, iso-8859-1 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive
The client will accept only UTF-8 and iso-8859-1 char sets.
Request:"http://example.com"
GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: UTF-8, iso-8859-1;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive
The client will accept UTF-8 and iso-8859-1 char sets but prefers UTF-8 (which has a quality factor of 1.0).
Request:"http://example.com"
GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: UTF-8, iso-8859-1;q=0.8, *;q=0.5 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive
The client will accept any charset but prefers UTF-8 and then iso-8859-1 if UTF-8 is not available.
Parameter | Description |
---|---|
type | A character set name. This can also be a * for all character sets |
QualityFactor | The quality factor in the format ;q=0.8 (optional) |