revision:
To display an HTML page correctly, a web browser must know the character set used in the page. This is specified in the <meta> tag.
The ASCII Character Set uses the values from 0 to 31 (and 127) for control characters, the values from 32 to 126 for letters, digits, and symbols. It does not use the values from 128 to 255.
The ANSI Character Set (Windows-1252) is identical to ASCII for the values from 0 to 127. ANSI has a proprietary set of characters for the values from 128 to 159. It is identical to UTF-8 for the values from 160 to 255.
The ISO-8859-1 Character Setis identical to ASCII for the values from 0 to 127. It does not use the values from 128 to 159 and is identical to UTF-8 for the values from 160 to 255.
The UTF-8 Character Set is identical to ASCII for the values from 0 to 127. It does not use the values from 128 to 159 and is identical to both ANSI and 8859-1 for the values from 160 to 255. UTF-8 continues from the value 256 with more than 10 000 different characters.
<meta charset="character_set">
Charset attribute in <meta> tag specifies the character encoding for the HTML document.
<script charset="character_set">
Charset attribute in the script element specifies the character encoding used in an external script.
The HTML5 specification encourages web developers to use the UTF-8 character set!
<head> <meta name="keywords" charset="UTF-8" content="Meta Tags, Metadata" /> </head>
codes:
<script charset="UTf-8"> document.getElementById("demo").innerHTML = "Hello!"; </script>