The accept-charset attribute is used to define the character encoding and is used for form submission. The default value of the accept-charset attribute is “UNKNOWN” string which indicates the encoding equals to the encoding of the document containing the <form> element.
Syntax:
<form accept-charset = "character_set">
Attribute Value: The attribute value contains the list separated value of one or more encoding attributes. The common value of encoding attribute is: UTF-8, ISO-8859-1. This attribute always associated with the form element only.
Example:
<!DOCTYPE html> <html> <head> <title>accept-charset attribute</title> <style> h1 { color:green; } body { text-align:center; } </style> </head> <body> <h1>GeeksforGeeks</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:

Supported Browsers: The browser supported by accept-charset attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Apple Safari
Recommended Posts:
- HTML | DOM Form acceptCharset Property
- HTML | <html> xmlns Attribute
- HTML | scoped Attribute
- HTML | <th> valign Attribute
- HTML | <col> align Attribute
- HTML | poster Attribute
- HTML | Class Attribute
- HTML | style attribute
- HTML | <area> target Attribute
- HTML | oninvalid Event Attribute
- HTML | <select> autocomplete Attribute
- HTML & CSS | Tabindex attribute & Navigation bars
- HTML | <table> bgcolor Attribute
- HTML | onsubmit Event Attribute
- HTML | onunload Event Attribute
- HTML | srcdoc Attribute
- HTML | Marquee truespeed attribute
- HTML | onkeyup Event Attribute
- HTML | ondrop Event Attribute
- HTML | <td> abbr Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


