Latest web development tutorials

HTML form accept-charset attribute

Tag Reference HTML form HTML <form> tag

Examples

With accept-charset attribute form:

<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"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the accept-charset attribute.


Definition and Usage

accept-charset attribute specifies that the form is submitted using character encoding.

The default value is a reserved string "UNKNOWN" (indicating a coding coding document containing <form> element).


Differences between HTML 4.01 and HTML5

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


grammar

<form accept-charset="character_set">

Property Value

描述
character_set 表单提交时使用的字符编码列表,多个字符编码使用空格分隔。

常用值:

  • UTF-8 - Unicode 字符编码
  • ISO-8859-1 - 拉丁字母表的字符编码

理论上讲,可使用任何字符编码,但没有浏览器可以理解所有的编码。字符编码使用得越广泛,浏览器对其支持越好。

如需查看所有可用的字符编码,请访问我们的 字符编码参考手册



Tag Reference HTML form HTML <form> tag