Bhylu

HTML Charsets

Character encoding maps stored bytes to characters. If the file, server headers, and document declaration disagree, readers may see replacement symbols or corrupted text.

How it works

  • Save the source file as UTF-8 and place <meta charset="utf-8"> near the beginning of head, within the first 1024 bytes of the document.
  • A server’s HTTP Content-Type header also communicates encoding. Configure it consistently with the actual file rather than trying to repair incorrect bytes through CSS.
  • UTF-8 supports international text, symbols, and emoji. Language declarations such as lang="en" identify language, not character encoding.

A practical example

HTML

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Café workshop notes</title>
</head>
<body><p>Café · résumé · 🌱</p></body>
</html>

When the file is stored and served correctly, the accented characters and emoji should remain intact. The declared language and encoding have separate responsibilities.