HTML <form> Tag accept-charset Attribute
Examples
Used in Forms accept-charset
Attribute:
<form action="form_action.asp" accept-charset="utf-8"> <p>First name: <input type="text" name="fname" /></p> <p>Last name: <input type="text" name="lname" /></p> <input type="submit" value="Submit" /> </form>
Definition and Usage
accept-charset
This attribute specifies the charsets accepted by the server when processing form data.
accept-charset
This attribute allows you to specify a series of charsets that the server must support in order to correctly interpret the data in the form.
The value of this attribute is a list of charset names enclosed in quotes. If the acceptable charset does not match the charset used by the user, the browser can choose to ignore the form or treat the form differently.
The default value of this attribute is "unknown", indicating that the character set of the form is the same as the character set of the document containing the form.
Tip:Avoid using this attribute. File uploads should be validated on the server side.
Browser Support
Attribute | Chrome | Internet Explorer / Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
accept-charset | Yes | Yes | Yes | Yes | Yes |
Syntax
<form accept-charset="character_set">
Attribute Value
Value | Description |
---|---|
character_set |
One or more character sets that the server can handle. If multiple character sets need to be specified, they should be separated by commas. Common character sets include:
In theory, any character set can be used, but not all browsers can understand them. The more widely a character set is used, the more likely browsers are to understand it. To view all available character sets, please visit our Character Set Reference Manual. |