accept-charset (HTML attribute)

Spec
Depr. Version
No HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Buggy Full Full Full Full

Syntax

accept-charset="character set"

Description

The accept-charset attribute specifies the character encodings that the server can handle or process for input data.

Example

In this form, we tell the server to accept Windows-only character sets (which isn’t a brilliant idea, to be honest):

<form action="form-to-email.php" method="post"
    accept-charset="windows-1252">
  <div>
    <label for="txtname">Name:</label>
    <input type="text" name="txtname" id="txtname"/>
  </div>
  ⋮
</form>

Value

This attribute can accept a space- and/or comma-delimited list of charset values. The default value for this attribute is the reserved string “UNKNOWN.” Browsers may interpret this value as the character encoding specified in the head of the document.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Buggy Buggy Buggy Buggy Full Full Full Full Full Full Full Full Full Full Full Full Full

Internet Explorer’s support for accept-charset is buggy. If the attribute’s specified as "ISO-8859-1", IE will happily send data encoded as "Windows-1252".

User-contributed notes

ID:
#2
Contributed:
by AutisticCuckoo
Date:
Fri, 28 Mar 2008 11:03:00 GMT

'User agents may interpret this value as the character encoding specified in the head of the document.'

It would be more accurate to say, '...the character encoding used in the enclosing document.'

The encoding may not be specified in the head, or, if it is, may be overridden by encoding information sent in a Content-Type HTTP header by the server. It may also be overridden by the user agent, if the user has chosen to do so.

Related Products