You are here: Reference > HTML > attributes > accept-charset (form)

accept-charset attribute (form)

Browser support:
Sets a list of character encodings for a form.
By default, the character set of the form is the same as the character set of the entire document (you can set the character set of the document with the charset attribute of the meta tag).
If any element of the form contains characters that cannot be represented by the character set of the document, then you need to define the accept-charset attribute.
When the form is submitted to a server, the browser uses the character set(s) to convert the text content of the form to a byte stream (the Content-Type HTTP header of the message will contain the used character encoding).
Use UTF-8 encoding on your site and in the database of your server to avoid internationalization problems.
JavaScript page for this attribute: acceptCharset. You can find other example(s) there.

Possible values:

String that sets a list of accepted character sets. The name of a character set is case-insensitive. The separator character between the character sets can be a space or a comma. For more information, see the page for character sets.
Default: UNKNOWN.

Example HTML code 1:

This example illustrates the use of the accept-charset attribute:
<form action="#URL#" method="post" accept-charset="UTF-8">
    User Name: <input type="text" name="userName" />
    <br />
    Password: <input type="password" name="password" />
    <br />
    <input type="submit" value="Sign in" />
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content