Declaring Character Encodings In Html


I"m currently participating in the #100DaysOfCode challenge and documenting my journey on Twitter. So far, I"ve been reviewing the holy trifecta of web thangvi.comelopment: HTML, CSS, & JavaScript. On Day 4, I shared that one of the things I reviewed was the importance of including in an HTML tệp tin.

Bạn đang xem: Declaring character encodings in html

Xem thêm: 27 Simple And Free Seo Tools, Software And Articles, Seo Checker

Justthangvi.comonT about the job hunt (who’s looking for a tư vấn role!) và reviewed some #JavaScript Ended the night w/ some #HTML:* learned the importance of including within the * basic HTML page anatomy#100DaysOfCode

I got a response asking lớn explain why. As I was typing my answer, I found that I had a lot lớn say to lớn fit into lớn one tweet, and it would be easier to write up a blog post.

What is ?

Let"s break down the line to lớn derive sầu its meaning:

is a HTML tag that contains metadata about a website page, or more specifically, descriptors that tell tìm kiếm engines what type of nội dung a web page contains that is hidden from display.charset is an HTML attribute that defines the character encoding for your browser khổng lồ use when displaying the trang web content.utf-8 is a specific character encoding.

In other words, tells the browser to lớn use the utf-8 character encoding when translating machine code into human-readable text & vice versa lớn be displayed in the browser.

Why "utf-8"?

Today, more than 90% of all websites use UTF-8. Before TF-8 became the standard, ASCII was used. Unfortunately, ASCII only encodes English characters, so if you used other languages whose alphabet does not consist of English characters, the text wouldn"t be properly displayed on your screen.

For example, say I wanted khổng lồ display some Arabic text that says "Hello World!" on a screen using the following snippet of code with the charmix mix equal lớn ascii: