charset and Unicode Handling Special Characters
Use UTF-8 and HTML entities to display any character correctly.
The charset Declaration
Every HTML document must declare its character encoding. The standard is UTF-8: <meta charset="utf-8"> as the very first element of <head>. Without it, the browser guesses, which often goes wrong for non-ASCII text.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page</title>Why UTF-8?
UTF-8 encodes every Unicode character: every script, every emoji, every symbol. It is backward-compatible with ASCII (a-z, 0-9 stay single-byte) and is the dominant encoding on the modern web — over 98% of pages by 2024 are UTF-8.
All lessons in this course
- The lang Attribute and Screen Readers
- dir=rtl for Right-to-Left Text
- The bdi and bdo Elements
- charset and Unicode Handling Special Characters