Skip to main content
Albero Academy

Entities & Internationalization

Display reserved and special characters with HTML entities, and prepare pages for multiple languages with lang, dir and charset.

Chapter 15HTML12 min readBeginner friendly
  • #HTML
  • #Entities
  • #i18n

Some characters can't be typed directly into HTML (they'd be read as code), and pages increasingly serve multiple languages and scripts. This chapter covers entities for special characters and the basics of internationalization (i18n).

HTML entities

An entity is a code starting with & and ending with ; that represents a character. They let you show symbols that aren't on the keyboard:

EntityShows
©© (copyright)
&rupee; / ₹₹
—— (em dash)
 A non-breaking space
→→ (arrow)

Reserved characters

A few characters are part of HTML syntax, so to display them literally you must use their entity — otherwise the browser tries to interpret them as markup:

CharacterEntityWhy
<&lt;Would start a tag
>&gt;Would end a tag
&&amp;Would start an entity
"&quot;Would end an attribute value
showing code in a page
<!-- To display: if (a < b && c > d) -->
<code>if (a &lt; b &amp;&amp; c &gt; d)</code>

Character encoding

<meta charset="UTF-8"> lets a page display essentially every character from every language — Devanagari, Arabic, Chinese, emoji — directly, without entities. It's why the charset tag is non-negotiable.

lang & dir

language & direction
<html lang="en"> <!-- page language: helps SEO & screen readers -->
<p lang="hi">नमस्ते, Albero में आपका स्वागत है</p> <!-- per-element override -->
<html lang="ar" dir="rtl"> <!-- right-to-left scripts (Arabic, Hebrew) -->

Practice

Write a footer line with a &copy;, the rupee symbol and an em dash using entities. Then show a snippet of code in a <code> element that includes <, > and & escaped correctly, and add a lang attribute to a non-English sentence.

Key takeaways

  1. 01Entities (&name; or &#code;) display symbols not on the keyboard — ©, ₹, —, →, non-breaking space.
  2. 02Escape reserved characters: < → &lt;, > → &gt;, & → &amp;, " → &quot;.
  3. 03UTF-8 (via meta charset) displays every language and emoji directly.
  4. 04Set lang on <html> (and override per element) for correct pronunciation and SEO.
  5. 05Use dir="rtl" for right-to-left scripts like Arabic and Hebrew.