-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics
A charset (character set) in HTML defines the encoding used to display text characters on a webpage. It tells the browser how to interpret the bytes in your HTML file into readable characters.
Ensures correct display of text, especially for non-English or special characters
Prevents garbled or unreadable characters
Supports internationalization and multiple languages
UTF-8: The most popular charset today, supports almost all characters and languages.
ISO-8859-1 (Latin-1): Supports Western European languages.
UTF-16: Supports all Unicode characters, less commonly used for web.
ASCII: Supports basic English characters only.
Use the <meta>
tag inside the <head>
section:
<meta charset="UTF-8" />
This tag tells browsers to interpret the document using UTF-8 encoding.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Charset Example</title>
</head>
<body>
<p>Example with special characters: ñ, ü, ö, 漢字, 😊</p>
</body>
</html>
Web servers can send the charset via HTTP headers, e.g.:
Content-Type: text/html; charset=UTF-8
This complements or overrides the <meta charset>
tag.
Q1. Write the correct HTML <meta>
tag to set charset to UTF-8.
Q2. Explain why UTF-8 is preferred over ASCII for webpages.
Q3. Show how to declare ISO-8859-1 charset in HTML.
Q4. Describe what happens if no charset is declared.
Q5. Write a webpage that displays characters from multiple languages correctly.
Q6. Explain the difference between UTF-8 and UTF-16.
Q7. Demonstrate how to set charset in HTTP server headers (example for Apache or Nginx).
Q8. Identify charset problems from given garbled text.
Q9. Explain why charset declaration should be as early as possible in HTML.
Q10. Create a sample HTML page with emoji and special symbols and correct charset.
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics