Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Form acceptCharset property

Form acceptCharset property

Form Object Reference Form Object


Definition and Usage

The acceptCharset property can set or return a comma-separated list of character sets acceptable to the server.

Syntax

formObject.acceptCharset=

value

The acceptCharset property can be one of the following values:

Value Description
character-set One or more character sets acceptable to the server. Multiple character sets are separated by commas.

Common values:

  • UTF-8 - Unicode encoding
  • ISO-8859-1 - character encoding for Latin letters
  • In theory, any character encoding can be used, but not all browsers support it. So please use common character encodings.

    For all character encodings, please see ourCharacter Set Reference Manual.

    |

    Browser support

    Internet ExplorerFirefoxOperaGoogle ChromeSafari

    All major browsers support the acceptCharset property


    Tips and Notes

    Note: The accept-charset attribute does not work properly in IE browsers. If accept-charset="ISO-8859-1", the data will be sent encoded as "Windows-1252".


    Example

    Example

    Return the value of the accept-charset attribute of the form:

    First name:

    Last name:

    The example above produces the following output:

    ISO-8859-1

    Try it »


    Form Object Reference Form Object