Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is <meta charset="utf-8">?

Tags:

html

css

utf-8

I just started learning HTML (no coding background) and don't know what this means. I generally write it when I start the code after <!doctype html>, but I don't have any idea what it means. I also do not know what "doctype" means. What will happen if I don't use it?

like image 875
Fedora Avatar asked Apr 25 '15 19:04

Fedora


People also ask

What is this meta charset UTF-8?

The charset attribute specifies the character encoding for the HTML document. The HTML5 specification encourages web developers to use the UTF-8 character set, which covers almost all of the characters and symbols in the world!

What is meta charset for?

Meta Charset is what determines how text is transmitted and stored. This text data is usually converted to binary first and then there needs to be a kind of cipher that connects characters with their correct binary equivalents.

Is meta charset UTF-8 needed?

It doesn't matter which you use, but it's easier to type the first one. It also doesn't matter whether you type UTF-8 or utf-8 . You should always use the UTF-8 character encoding. (Remember that this means you also need to save your content as UTF-8.)

What is the use of UTF-8 in HTML?

The HTML5 Standard: Unicode UTF-8 Unicode enables processing, storage, and transport of text independent of platform and language. The default character encoding in HTML-5 is UTF-8.


1 Answers

The characters you are reading on your screen now each have a numerical value. In the ASCII format, for example, the letter 'A' is 65, 'B' is 66, and so on. If you look at a table of characters available in ASCII you will see that it isn't much use for someone who wishes to write something in Mandarin, Arabic, or Japanese. For characters / words from those languages to be displayed we needed another system of encoding them to and from numbers stored in computer memory.

UTF-8 is just one of the encoding methods that were invented to implement this requirement. It lets you write text in all kinds of languages, so French accents will appear perfectly fine, as will text like this:

Бзиа збаша (Bzia zbaşa), Фэсапщы, Ç'kemi, ሰላም, and even right-to-left writing such as this السلام عليكم

If you copy and paste the above text into Notepad and then try to save the file as ANSI (another format) you will receive a warning that saving in this format will lose some of the formatting. Accept it, then reload the text file and you'll see something like this:

???? ????? (Bzia zbasa), ???????, Ç'kemi, ???, and even right-to-left writing such as this ?????? ?????

like image 77
Peter Morris Avatar answered Sep 19 '22 22:09

Peter Morris