HTML Character Sets – Solved Practice Questions

Introduction

An HTML character set tells the browser how text and symbols are stored and displayed on a webpage. Today, UTF-8 is the standard character encoding because it supports almost every language, symbol, and emoji. In this chapter, you’ll practice using character sets with simple solved examples. HTML character sets help to understand the concepts.


Question 1

Problem Statement

Create a webpage that uses the UTF-8 character set.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>UTF-8 Example</title>

</head>
<body>

    <h1>Welcome to HTML</h1>

</body>
</html>

Output

Welcome to HTML

Step-by-Step Explanation

  • <meta charset="UTF-8"> defines the character encoding.
  • UTF-8 supports letters, symbols, and emojis.
  • It should be placed inside the <head> section.

Question 2

Problem Statement

Display text in multiple languages using UTF-8.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>Multiple Languages</title>

</head>
<body>

    <p>English: Welcome</p>

    <p>Hindi: नमस्ते</p>

    <p>French: Bonjour</p>

    <p>Japanese: こんにちは</p>

</body>
</html>

Output

English: Welcome

Hindi: नमस्ते

French: Bonjour

Japanese: こんにちは

Step-by-Step Explanation

  • UTF-8 supports many languages.
  • The browser displays each language correctly.
  • No extra settings are needed when UTF-8 is used.

Question 3

Problem Statement

Display symbols using the UTF-8 character set.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>UTF-8 Symbols</title>

</head>
<body>

    <p>₹ Indian Rupee</p>

    <p>© Copyright</p>

    <p>™ Trademark</p>

    <p>✓ Success</p>

</body>
</html>

Output

₹ Indian Rupee

© Copyright

™ Trademark

✓ Success

Step-by-Step Explanation

  • UTF-8 supports many common symbols.
  • Symbols can be typed directly into the HTML file.
  • Modern browsers display them correctly.

Question 4

Problem Statement

Display emojis using UTF-8.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>UTF-8 Emojis</title>

</head>
<body>

    <h1>😀 🚀 🎉 ❤️</h1>

</body>
</html>

Output

😀 🚀 🎉 ❤️

Step-by-Step Explanation

  • UTF-8 supports emoji characters.
  • Emojis can be typed directly into the HTML document.
  • Modern browsers display them correctly.

Question 5

Problem Statement

Create a webpage that uses special characters and multilingual text together.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>UTF-8 Demo</title>

</head>
<body>

    <h1>Welcome 😀</h1>

    <p>Price: ₹2,999</p>

    <p>Hindi: धन्यवाद</p>

    <p>French: Merci</p>

</body>
</html>

Output

Welcome 😀

Price: ₹2,999

Hindi: धन्यवाद

French: Merci

Step-by-Step Explanation

  • UTF-8 supports text from different languages.
  • It also supports symbols and emojis.
  • One character set is enough for most modern websites.

Question 6

Problem Statement

Place the UTF-8 character set declaration in the correct location.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>Correct Charset Location</title>

</head>
<body>

    <h1>HTML Character Set</h1>

</body>
</html>

Output

HTML Character Set

Step-by-Step Explanation

  • The <meta charset="UTF-8"> tag should be placed inside the <head> section.
  • It is recommended to place it near the top of the <head>.
  • This helps the browser correctly display all characters as the page loads.

Question 7

Problem Statement

Compare UTF-8 and ASCII character support.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>UTF-8 Example</title>

</head>
<body>

    <p>ASCII Text: Hello World</p>

    <p>UTF-8 Text: Hello नमस्ते 😀</p>

</body>
</html>

Output

ASCII Text: Hello World

UTF-8 Text: Hello नमस्ते 😀

Step-by-Step Explanation

  • ASCII supports a limited set of English characters.
  • UTF-8 supports English, other languages, symbols, and emojis.
  • UTF-8 is the standard character encoding for modern websites.

Question 8

Problem Statement

Display text with accented characters using UTF-8.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>Accented Characters</title>

</head>
<body>

    <p>Café</p>

    <p>Résumé</p>

    <p>São Paulo</p>

</body>
</html>

Output

Café

Résumé

São Paulo

Step-by-Step Explanation

  • UTF-8 supports accented characters.
  • Words from many languages display correctly.
  • No additional HTML entities are required when the file is saved in UTF-8.

Question 9

Problem Statement

Create a webpage that displays text, symbols, and emojis using UTF-8.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>UTF-8 Content</title>

</head>
<body>

    <h1>My Website 🚀</h1>

    <p>Course Fee: ₹1,999</p>

    <p>Copyright © 2026</p>

    <p>Thank You 😊</p>

</body>
</html>

Output

My Website 🚀

Course Fee: ₹1,999

Copyright © 2026

Thank You 😊

Step-by-Step Explanation

  • UTF-8 correctly displays emojis.
  • It also supports currency symbols.
  • Copyright symbols appear correctly.
  • A single UTF-8 encoding handles all these characters.

Question 10

Problem Statement

Create a complete HTML webpage using the UTF-8 character set.

HTML Code

<!DOCTYPE html>
<html>
<head>

    <meta charset="UTF-8">

    <title>HTML Character Set Example</title>

</head>
<body>

    <h1>Welcome to HTML 🌍</h1>

    <p>Price: ₹2,499</p>

    <p>Language: English, हिन्दी, Français</p>

    <p>Status: ✔ Completed</p>

    <p>Thank You 😊</p>

</body>
</html>

Output

Welcome to HTML 🌍

Price: ₹2,499

Language: English, हिन्दी, Français

Status: ✔ Completed

Thank You 😊

Step-by-Step Explanation

  • <meta charset="UTF-8"> sets the page encoding.
  • UTF-8 supports multiple languages.
  • Symbols and emojis display correctly.
  • UTF-8 is recommended for all modern HTML webpages.

Key Takeaways

  • A character set tells the browser how to display text.
  • UTF-8 is the standard character encoding for HTML5.
  • Add <meta charset="UTF-8"> inside the <head> section.
  • UTF-8 supports almost every language.
  • UTF-8 also supports symbols and emojis.
  • Modern websites should always use UTF-8.
  • UTF-8 is backward compatible with ASCII.
  • Save your HTML files using UTF-8 encoding.
  • UTF-8 helps prevent character display issues.
  • All modern browsers fully support UTF-8.

Frequently Asked Questions (FAQs)

1. What is a character set in HTML?

A character set defines how characters, symbols, and text are stored and displayed in a webpage.

2. Which character set should I use?

Use UTF-8 for all modern HTML webpages.

3. How do I define UTF-8 in HTML?

<meta charset="UTF-8">

4. Where should the charset tag be placed?

Inside the <head> section, preferably near the top.

5. Does UTF-8 support emojis?

Yes. UTF-8 supports emojis along with thousands of other Unicode characters.

6. Does UTF-8 support multiple languages?

Yes. It supports languages such as Hindi, Arabic, Japanese, French, Chinese, and many more.

7. Is UTF-8 better than ASCII?

Yes. UTF-8 includes all ASCII characters and supports many additional characters, symbols, and languages.

8. Should I save my HTML file in UTF-8?

Yes. Saving the file in UTF-8 ensures characters display correctly.

9. Do modern browsers support UTF-8?

Yes. All major modern browsers support UTF-8.

10. Is UTF-8 the default character set for HTML5?

Yes. UTF-8 is the recommended and most widely used character encoding for HTML5.

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.

Scroll to Top