HTML <form> accept-charsetAttribute

HTML form 标签参考手册HTML <form> Tag

Examples

A form with the accept-charset attribute:

<form action="demo_form.html" accept-charset="ISO-8859-1">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
<input type="submit" value="提交">
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the accept-charset attribute.


Definition and Usage

The accept-charset attribute specifies the character encodings to be used for the form submission.

The default value is the reserved string "UNKNOWN" (indicating that the encoding is the same as the encoding of the document containing the <form> element).


Differences between HTML 4.01 and HTML5

In HTML 4.01, the character encoding list can be separated by spaces or commas. In HTML5, the list must be separated by spaces.


Syntax

<form accept-charset="character_set">

Attribute Values

Value Description
character_set A list of character encodings to be used for the form submission; multiple character encodings are separated by spaces.

Common values:

  • UTF-8 - Unicode character encoding
  • ISO-8859-1 - character encoding for the Latin alphabet

Theoretically, any character encoding can be used, but no browser understands all encodings. The more widely a character encoding is used, the better browser support it has.

To view all available character encodings, please visit ourCharacter Encoding Reference Manual。



HTML form 标签参考手册HTML <form> Tag Other Extensions