MyInternships.in

HTML Attributes

HTML <form> accept-charset Attribute

The accept-charset attribute specifies the character encodings the server accepts for a submitted form. In modern practice it is almost always UTF-8.


The <form> accept-charset Attribute

The accept-charset attribute belongs to the <form> element. It declares the character encoding, or a space-separated list of encodings, the server will accept when the form data is submitted. By default, forms are submitted using the encoding of the page, so today this is almost always UTF-8.

Syntax

ℹ️

Syntax: <form accept-charset="charset-list">. The value is one encoding name, or several separated by spaces or commas.

The basic pattern
Example
<form accept-charset="UTF-8"> ... </form>

Example

Run the example to see a UTF-8 encoded application form that safely handles names in any language.

Force UTF-8 encoding for a job-application form
Example
<!DOCTYPE html>
<html>
  <body>
    <form action="/apply" method="post" accept-charset="UTF-8">
      <label for="name">Your name</label><br>
      <input type="text" id="name" name="name" placeholder="e.g. Aarav Sharma"><br><br>
      <button type="submit">Apply</button>
    </form>
  </body>
</html>

Attribute Values

ValueDescription
UTF-8Universal Unicode encoding, the recommended default
ISO-8859-1Legacy Western European (Latin-1) encoding
UTF-1616-bit Unicode encoding, rarely used for forms
charset listMultiple encodings separated by spaces, e.g. "UTF-8 ISO-8859-1"
💡

In nearly all modern sites you should serve pages as UTF-8 (via <meta charset="UTF-8">) and leave accept-charset unset or set to UTF-8 to safely handle names in any language.

Key Takeaways

  • accept-charset applies only to the <form> element.
  • It lists the character encodings the server will accept on submit.
  • UTF-8 is the correct default for virtually all sites.
  • Multiple encodings can be listed separated by spaces.
  • Pair it with <meta charset="UTF-8"> for consistent handling.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships