HTML
📌 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.
- If a symbol has a named entity, you can use it:€
- 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
<p>Euro symbol: € or €</p>
<p>Greek alpha: α or α</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.
- To add an emoji, you can simply use its Unicode code: 😀
- You can adjust the size using CSS, e.g., font-size.
Examples
<p>Smiling face: 😀 (😀)</p>
<p style="font-size:50px">Large emoji: 😄</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.
- In HTML, this is defined with the
<meta charset="UTF-8">tag. - 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
<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.
- Each special character is replaced by % followed by hexadecimal digits.
- For example, a space becomes %20 and € becomes %E2%82%AC in UTF-8 encoding.
Examples
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
- Charset ensures that symbols, emojis, and special characters display correctly.
- Entities allow you to safely include symbols and special characters in your HTML.
- Unicode codes make it possible to show emojis and characters not directly available on the keyboard.
- URL encoding ensures that URLs containing non-ASCII characters work reliably.
