HTML accept-charset Attribute

The HTML accept-charset attribute specifies the character encoding that must be used for the form submission.

You can use this attribute only on the <form> element.

The attribute value contains a list separated value of one or more encodings. The default value of the attribute is “UNKNOWN”, which indicates that the encoding equals the encoding of the document having the <form> element.

Syntax

<form accept-charset="character_set"></form>

Example of the HTML accept-charset attribute:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      input {
        display: block;
        margin-bottom: 10px;
      }
    </style>
  </head>
  <body>
    <form action="/form/submit" accept-charset="ISO-8859-1" method="post">
      <input type="text" name="name" placeholder="Enter your Name">
      <input type="text" name="surname" placeholder="Enter your Surname">
      <input type="number" name="age" placeholder="Enter your Age">
      <input type="submit" value="Send">
    </form>
  </body>
</html>

Practice Your Knowledge

What is the HTML 'accept-charset' attribute?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?