L
LLLOS.ai
Learn
L

Ask Your Tutor · Computer Science

How does UTF-8 handle languages like Hindi or Chinese?

General knowledge In depth Asked by Anonymous 23 Oct 2026, 6:59 AM IST Updated

In one line

UTF-8 stores every letter, symbol, or character—no matter the language—using a special code that can grow bigger for complex scripts like Hindi or Chinese.

The rule

UTF-8 is a variable-length character encoding for Unicode, using 1 to 4 bytes to represent each character.

A byte is 8 bits (like 8 on/off switches). A character encoding is a way to turn letters and symbols into numbers so computers can store and share them.

Let's understand it simply

Imagine you have a big box of crayons. For English, you only need a few basic colors (like red, blue, green). But for Hindi or Chinese, you need many more colors to draw all the letters and symbols. UTF-8 is like a smart crayon box. For simple letters (A, B, C), it uses just one slot. For more complex letters (like 'अ' in Hindi or '你' in Chinese), it uses extra slots. This way, it can fit every language in the world into one box!

How UTF-8 stores different languages
CharacterUnicode code pointUTF-8 bytes
A (English)U+004141
क (Hindi)U+0915E0 A4 95
你 (Chinese)U+4F60E4 BD A0

How it works

  1. Every character in every language is given a unique number, called a Unicode code point.
  2. UTF-8 takes this number and stores it using 1, 2, 3, or 4 bytes.
  3. Simple English letters (like 'A') use just 1 byte.
  4. Hindi letters (like 'क') or Chinese characters (like '你') use 2, 3, or 4 bytes, depending on their code point.
  5. When you type or read a file, the computer reads these bytes and knows how to turn them back into the right letter or symbol.
How UTF-8 encodes a character
  1. Find the Unicode code point for the character.
  2. Decide how many bytes are needed (1–4).
  3. Break the code point into bytes as per UTF-8 rules.
  4. Store or send these bytes.
  5. When reading, combine the bytes to get the original character.

The story behind it

In the 1980s and 1990s, computers mostly used English. Other languages had trouble because their letters didn't fit in the old systems. Unicode was created to give every letter in every language a unique number. UTF-8 was invented by Ken Thompson and Rob Pike in 1992 to store these numbers efficiently. One fun fact: UTF-8 was designed so that English text would look the same as before, but now you could add any language without breaking old files.

Where you see it in real life

  • WhatsApp messages: When you send a message in Hindi or Chinese, UTF-8 makes sure the right letters appear on your friend's phone.
  • Websites: Websites use UTF-8 so people can read them in any language, from Tamil to Russian.
  • File names: You can save a file as 'मेरा_डॉक्युमेंट.txt' or '我的文件.txt' because UTF-8 supports these letters.
  • Programming: When you write code that handles text, UTF-8 lets your program work with any language.
  • SMS and emails: Modern phones and email apps use UTF-8 so you can send messages in any script.
  • Government forms: Online forms in India use UTF-8 so you can fill them in Hindi, Bengali, or any other language.

Why it matters

  • Universal communication: Lets people from different countries share information without errors.
  • Saves space: English text stays small, but other languages fit too.
  • No more confusion: Old systems would mix up letters; UTF-8 avoids this.
  • Needed for modern apps: Almost every website, app, and phone uses UTF-8 today.

Worked example

Let's see how UTF-8 stores the Hindi letter 'क' and the Chinese character '你'.

Given: 'A' (English), 'क' (Hindi), '你' (Chinese)
Step 1: Find Unicode code points
  'A' = U+0041
  'क' = U+0915
  '你' = U+4F60
Step 2: Encode in UTF-8
  'A': U+0041 → 1 byte: 01000001 (hex: 41)
  'क': U+0915 → 3 bytes: E0 A4 95
  '你': U+4F60 → 3 bytes: E4 BD A0
Step 3: Result
  'A' uses 1 byte, 'क' and '你' use 3 bytes each in UTF-8.

Common mistakes

  • Thinking UTF-8 can only handle English: It can handle every language in the world.
  • Believing every character uses the same space: Hindi and Chinese letters use more bytes than English letters.
  • Mixing up Unicode and UTF-8: Unicode is the list of all characters; UTF-8 is one way to store them.
  • Assuming older systems always work with UTF-8: Some old apps may not display Hindi or Chinese correctly if they don't support UTF-8.

Remember it

UTF-8 is like a stretchy bag: small for English, bigger for Hindi or Chinese, but fits every letter in the world.

Check yourself

Why does 'क' (Hindi) use more bytes in UTF-8 than 'A' (English)?

Because 'क' has a higher Unicode code point, so UTF-8 needs more bytes to store it.

What is the main job of UTF-8?

To store and share every character from every language using bytes.

If a file is saved in UTF-8, can it show both Hindi and English text?

Yes, because UTF-8 supports all languages.

What is the difference between Unicode and UTF-8?

Unicode is the list of all characters; UTF-8 is a way to store those characters.

Quick recap

  • UTF-8 can store every language, using 1 to 4 bytes per character.
  • Simple English letters use 1 byte; Hindi and Chinese letters use more.
  • UTF-8 is the standard for websites, apps, and messages worldwide.
  • Unicode gives each character a unique number; UTF-8 stores it efficiently.
Written by the LLOS.ai tutor. Asked by Anonymous on 23 Oct 2026, 6:59 AM IST