Dofactory.com
Dofactory.com

HTML <form> accept-charset Attribute

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.

Example

#

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>

Using accept-charset

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.


Syntax

<form accept-charset="character-set">

Values

#

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.

Browser support

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

You may also like

 Back to <form>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides