📌 HTML Symbol

🔹 Using Special Characters in HTML

Some characters, like mathematical signs, arrows, technical symbols, or currency signs, are not directly available on a keyboard.

To display them correctly on a web page, HTML provides entities, which are special codes that the browser interprets as the intended symbol.

  1. If a symbol has a named entity, you can use it:€
  2. If not, you can use a numeric code (decimal: € or hexadecimal: €)

This ensures that your symbols appear correctly, regardless of the character encoding of the page.

Examples

HTML

<p>Euro symbol: &euro; or &#8364;</p>
<p>Greek alpha: &alpha; or &#945;</p>
                

These codes guarantee that the symbols display properly across different systems and browsers.

🔹 HTML Emojis

Emojis are not image files—they are part of the Unicode character set, which is included in UTF-8.

  1. To add an emoji, you can simply use its Unicode code: &#128512;
  2. You can adjust the size using CSS, e.g., font-size.

Examples

HTML

<p>Smiling face: &#128512; (😀)</p>
<p style="font-size:50px">Large emoji: &#128516;</p>
                

Emojis behave like regular text and scale according to font size.

🔹 Character Set (Charset / Encoding)

To display text and symbols correctly, the browser must know which character set your page uses.

  1. In HTML, this is defined with the <meta charset="UTF-8"> tag.
  2. UTF-8 is recommended because it supports virtually all characters and symbols in the world.

Older encodings like ASCII or ISO-8859-1 support only a limited set of characters.

Examples

HTML

<head>
    <meta charset="UTF-8">
</head>
<body>
    <p>Turkish characters: ç, ğ, ü, ş, ö, İ</p>
</body>
                

Using UTF-8 ensures that language-specific letters and symbols display correctly.

🔹 URL Encoding (Percent Encoding)

Web addresses (URLs) can only contain ASCII characters.

If a URL includes special characters, spaces, or non-English letters, they must be URL encoded using percent encoding.

  1. Each special character is replaced by % followed by hexadecimal digits.
  2. For example, a space becomes %20 and becomes %E2%82%AC in UTF-8 encoding.

Examples

HTML

Text: Merhaba Dünya!
Encoded: Merhaba%20D%C3%BCnya%21
<a href="search.php?q=Merhaba%20D%C3%BCnya%21">Search</a>
                

URL encoding is essential for forms, search queries, and ensuring that links remain valid across browsers.

🔹 Connecting All Concepts

  1. Charset ensures that symbols, emojis, and special characters display correctly.
  2. Entities allow you to safely include symbols and special characters in your HTML.
  3. Unicode codes make it possible to show emojis and characters not directly available on the keyboard.
  4. URL encoding ensures that URLs containing non-ASCII characters work reliably.