HTML accept-charset Attribute


The accept-charset attribute in HTML is used to set the character encodings for the form.

Following is the syntax−

<form accept-charset="char_set">

Above, char_set is a list of one or more character encodings. This list has space-separated encodings. It can be for Unicode (UTF-8) as well as Latin alphabet (ISO-8859-1).

Let us now see an example to implement the accept-charset attribute−

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Result</h2>
<form action="" accept-charset="ISO-8859-1">
   <label for="stinfo">Student:</label>
   <input type="text" id ="stinfo"><br>
   <label for="sub">Subject:</label>
   <input type="text"><br>
   <label for="rank">Rank:</label>
   <input type="number"><br>
   <label for="marks">Marks:</label>
   <input type="number"><br><br>
   <input type="submit">
</form>
</body>
</html>

Output

Updated on: 12-Jun-2020

110 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements