Change the value of the accept-charset attribute in a form to UTF-8:
document.getElementById("myForm").acceptCharset = "UTF-8";
Click the button to change the value of the accept-charset attribute in the form element.
<!DOCTYPE html> <html> <body> <form id="myForm" accept-charset="ISO-8859-1"> First name: <input type="text" name="fname" value="CSS"><br> Last name: <input type="text" name="lname" value="HTML"><br> </form>/*from ww w.j a va2 s .c om*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myForm").acceptCharset = "UTF-8"; document.getElementById("demo").innerHTML = "The character-set was changed from ISO-8859-1 to UTF8."; } </script> </body> </html>