HTML Charsets
In this page:
<meta charset="UTF-8">
Character Set क्या है?
एक character set एक standardized character-encoding system है। शुरुआती computer systems ASCII (जो सिर्फ basic English characters को support करता था) या ISO-8859-1 इस्तेमाल करते थे, जबकि modern web standards global languages को natively support करने के लिए UTF-8 इस्तेमाल करते हैं।
उदाहरण: What is a Character Set?
<meta charset="UTF-8">
UTF-8 Standard
UTF-8 एक अत्यधिक efficient, variable-width character encoding standard है जो mathematical symbols, global alphabets, और emojis सहित 10 लाख से ज्यादा unique characters को represent कर सकता है।
उदाहरण: The UTF-8 Standard
<meta charset="UTF-8">
<p>Supports café, 日本語, and 😀</p>
head Section में Charsets Declare करना
यह सुनिश्चित करने के लिए कि आपका webpage सही तरीके से render हो, आपको character set meta tag को अपने document के head section के अंदर रखना होगा। इसे फ़ाइल के पहले 1024 bytes के अंदर रखा जाना चाहिए, ताकि browser आपका text load करने से पहले इसे पढ़ ले।
उदाहरण: Declaring Charsets in the head Section
<head>
<meta charset="UTF-8">
<title>My Page</title>
</head>
Character Errors को पहचानना और ठीक करना
अगर किसी webpage में missing या गलत character set declaration है, तो curly quotes, dashes, और accented letters जैसे special characters टूटे-फूटे, गड़बड़ symbols (जैसे ’ या é) के रूप में दिखेंगे। इस समस्या को mojibake कहा जाता है।
उदाहरण: Identifying and Fixing Character Errors
<!-- Missing charset can cause: café to render as café -->
<meta charset="UTF-8">
Server Headers बनाम HTML Meta Tags
जब कोई visitor आपका webpage load करता है, तो आपका web server एक HTTP header भेजता है जो content type और character set बताता है।
हालांकि server के HTTP header की priority आपके HTML meta tag से ज्यादा होती है, फिर भी अपने HTML में meta charset tag शामिल करना जरूरी है ताकि page locally load होने पर भी सही तरीके से render हो।
उदाहरण: Server Headers vs. HTML Meta Tags
<!-- HTTP header: Content-Type: text/html; charset=UTF-8 -->
<meta charset="UTF-8">
Chapter Quiz — Complete all 10 topics to unlock
0/10 topics done
Complete these topics first: