HTML5 ASCII and UTF-8
ASCII and UTF-8
In this tutorial, we’ll teach you different character encoding sequences predominantly ASCCI and UTF-8 are used in HTML%.
Apart from that, we’ll tell you what values of asci and utf-8 are the same and what values are different?
To compile a web page correctly, the web browser should be aware of an appropriate character encoding system.
From ASCII to UF-8
ASCII was the first character standard developed by an American computer scientist. ASCII assigned 128 characters to the letter, numbers, and special characters that were used on the internet at that time.
It includes numbers (0-9), English Letters (A-Z), and some special characters like /,@, #,$,%. ^, &, *, (, ).
HTML5 is compatible with UTF-8 character encoding standard and it encourages the developers to use the same standard. It covers almost all the characters and symbols that exist in the world till now.
The HTML5 charset Attribute
As we have discussed earlier, to display a web page appropriately web browser must know which character encoding standard we’ve used in our code.
To get this job done, we need to specify it in the <meta>
tag:
<meta charset=”UTF-8”>
ASCII and UTF-8 Charsets
Example
<!DOCTYPE html> <html lang="en"> <head> <title> ASCII and UTF-8 </title> <style> body { font-size: 40px; } </style> </head> <body> <span style="font-size: 150px;"> </span> <p>It will display </p> <p>It will display </p> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <style> body { font-size: 40px; } </style> </head> <body> <span style="font-size: 150px;"> </span> <p>It will display !</p> <p>It will display !</p> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <style> body { font-size: 40px; } </style> </head> <body> <span style="font-size: 150px;">#</span> <p>It will display #</p> <p>It will display #</p> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title> ASCII and UTF-8 </title> </head> <body> <span style="font-size: 150px;">(</span> <p>It will display (</p> <p>It will display (</p> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <style> body { font-size: 40px; } </style> </head> <body> <span style="font-size: 150px;">/</span> <p>It will display /</p> <p>It will display /</p> </body> </html>
The ASCII Character Set
ASCII assigns the value from 0 to 31 to control characters. It assigns the value from 32 to 126 to letters, digits, and numbers. It does not use any value from 126 to 255 for its character encoding.
The UTF-8 Character Set
UTF-8 is identical to ASCII for the values from 0 to 127. UTF-8 does not assign the value from 128 to 159.
UTF-8 is similar to both the ANSI and 8859-1 for the values ranging from 160 to255.
From then on, UTF-8 continues from the value 256 with its. 10,000 different characters.
To learn more about ASCII and UTF-8 character sequencing, visit, https://www.w3schools.com/charsets/default.asp