The accept-charset
attribute on a form
tag sets the character encoding for the form data during submission.
If not specified, the default is the same as the page character encoding, which is usually UTF-8.
An accept-charset
attribute on a form
element.
The form uses UTF-8 character encoding.
<form action="/tutorial/action.html" accept-charset="utf-8">
<input type="text" name="firstname" placeholder="First name">
<input type="text" name="lastname" placeholder="Last name">
<button type="submit">Submit</button>
</form>
The accept-charset
attribute sets the character encoding for form submission.
This only applies to the <form> that has this attribute, and not page-wide.
If not specified, the default is the same as the page character encoding, which is usually UTF-8.
Characters sets are used to encode the form-data submitted to the server.
<form accept-charset="character-set">
Value | Description |
---|---|
character-set |
Space-separated list of character encodings. Common values are UTF-8 and ISO-8859-1. The default value is 'UNKNOWN'. For HTML5 pages this means that UTF-8 will be used. |
Here is when accept-charset
support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |