Open In App

HTTP headers | Accept-Charset

The HTTP Accept-Charset is a request type header. This header is used to indicate what character set are acceptable for the response from the server. The accept-charset header specifies the character encodings which are accepted by the client and this header also allows a user-agent to specify the charsets it supports.
With the help of content negotiation it selects the type of encoding and then uses it to inform the client of its choice with the Content-Type response header, which is usually present in charset= parameter. Our Web-Browser usually doesn’t send this header, as transmitting it would allow fingerprinting and the default value for each resource is usually correct. If this Header is not present, 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

Note: When the server fails to serve any character encoding form this request, it will send back a 406 Not Acceptable error code so to avoid this and provide better user experience if no Accept-Charset header is present, the default is that any character set is acceptable.



Syntax:

Directives: This header accepts three directives as mentioned above and described below:



Note: This ;q= defines the factor weighting, value placed in an order of preference expressed using a relative quality value.

Examples:

Supported Browsers: The browsers are not compatible with HTTP Accept-Charset header.

Article Tags :