HTML accept-charset attribute

HTML accept-charset attribute: It defines the character encoding which is used for form submission. While the default value of the accept-charset attribute is “UNKNOWN” string. And it indicates that encoding equals to the encoding of the document which contains the form element.

HTML accept-charset attribute

Syntax: <form accept-charset = “character_set”>

In this, the attribute value contains a list of one or more encoding attributes. While the common value of the attributes is UTF-8, ISO-8859-1. Actually, the attribute value contains a list separated value of one or more attributes. This attribute is always associated with the form element only.

Supported Browsers

The different type of browser which was supported by this attribute are as follows:

  • Apple Safari
  • Google Chrome
  • Firefox
  • Opera
  • Internet Explorer

Example:

 <!DOCTYPE html> 
<html> 
    <head> 
        <title>accept-charset attribute</title> 
        <style> 
            h1 { 
                color:green; 
            } 
            body { 
                text-align:center; 
            } 
        </style> 
    </head> 
    <body> 
        <h1>Freshersnow</h1> 
        <h2>accept-charset Attribute</h2> 
        <form action="#" accept-charset="UTF-8"> 
            First name: <input type = "text" name = "fname"><br> 
            Last name: <input type = "text" name = "lname"><br> 
            <input type="submit" value="Submit"> 
        </form> 
    </body> 
</html>

Output:

HTML accept-charset attribute