html tutorial - accept-charset Attribute in HTML - html5 - html code - html form



Accept charset attribute in html

Learn html - html tutorial - Accept charset attribute in html - html examples - html programs

  • The accept-charset attributes is used to specify the character encoding which is used for form submission.
  • By default, the reserved string value is “UNKNOWN”.
  • Which indicates that the encoding is equals to the encoding of the document containing<form> element.

Syntax for accept-charset attribute in HTML:

<form accept-charset=”character_set”>

Differences between HTML 4.01 and HTML5 for accept-charset attribute:

HTML 4.01

  • HTML4 does not support <details> element.

HTML 5

  • HTML5 support <details> element.

Applies To:

Element Attribute
<form> accept-charset

Values for accept-charset Attribute:

Value Description
Character_set
  • A space-separated list of one or more character encodings that are to be used for theform submission.
  • Common values: UTF-8 - Character encoding for Unicode ISO-8859-1 - Character encoding for the Latin alphabet
  • Sample Coding for accept-charset Attribute in HTML:

    Tryit=""><!DOCTYPE html>
    <html>
        <head>
            <title>Wikitechy accept-charset attribute</title>
        </head>
        <body>
           <h2>HTML accept-charset attribute with example</h2>
                <form action="acceptcharset.html" accept-charset="ISO-8859-1" onsubmit="alert('Submitted!');return false;">
                    Mail-ID: <input type="text" name="mail">
                    <br>
                    <br>
                    Password:  <input type="text" name="pwd">
                    <br>
                    <input type="submit" value="Submit">
                 
                </form>
        </body>
    </html>                                                                                                                                                                                                                                                                                                                                                                                                                    

    Code Explanation for accept-charset Attribute in HTML:

    accept-charset Attribute Code Explanation

    1. The accept-charset attribute declared as a ISO-8859-1 which is latin.

    Output for accept-charset Attribute in HTML:

    accept-charset Attribute Tag Output

    1. “𐌄mail” input has a Latin character.
    2. accept-charset1 Attribute Tag Output
    3. When user submit the form then the submitted value displayed in the URL in Unicode. Because the accept-charset attribute value is “ISO-8859-1”.
    4. accept-charset2 Attribute Tag Output
    5. 3. If the accept-charset attribute is set to “UTF-8”. Then the output will be shown above.

    Browser Support for accept-charset Attribute in HTML:

    yes yes yes yes yes

    Related Searches to accept-charset Attribute in html