---
title: 4.26 Unicode Strings
description: "A **Unicode string** is a string that can store characters from almost every writing system in the world, including English, Hindi, Chinese, Japanese, Arabic, emojis, mathematical symbols, and many other special characters. In Python 3, **all strings are Unicode by…"
url: "https://edcret.in/docs/python-programming/strings-python/4-26-unicode-strings/"
updated: "2026-07-29"
category: Python Programming / Strings
---

# 4.26 Unicode Strings

A **Unicode string** is a string that can store characters from almost every writing system in the world, including English, Hindi, Chinese, Japanese, Arabic, emojis, mathematical symbols, and many other special characters.

In Python 3, **all strings are Unicode by default**. This means you can directly store and manipulate international text without using any special syntax.

Unicode allows programs to work correctly with multilingual data, making Python suitable for developing applications used worldwide.

---

## Syntax

```
text = "Unicode characters"
```

### Components

| Component | Description |
| --- | --- |
| `text` | Variable storing the Unicode string. |
| `" "` | Quotes enclosing the string. |
| `Unicode characters` | Any valid Unicode characters. |

---

## Example 1: English Text

**main.py**

```
text = "Python Programming"

print(text)
```

### Output

```
Python Programming
```

### Explanation

- The string contains English characters.
- English letters are Unicode characters.
- Python stores the string as Unicode.

---

## Example 2: Hindi Text

**main.py**

```
text = "नमस्ते"

print(text)
```

### Output

```
नमस्ते
```

### Explanation

- The string contains Hindi characters.
- Python supports Unicode characters directly.
- No special configuration is required.

---

## Example 3: Chinese Text

**main.py**

```
text = "你好"

print(text)
```

### Output

```
你好
```

### Explanation

- The string contains Chinese characters.
- Python stores and prints them correctly.
- Unicode makes multilingual programming possible.

---

## Example 4: Emoji Characters

**main.py**

```
message = "Python ❤️"

print(message)
```

### Output

```
Python ❤️
```

### Explanation

- Emojis are also Unicode characters.
- Python treats them like any other character.
- They can be stored and displayed in strings.

---

## Example 5: User Input

**main.py**

```
name = input("Enter your name: ")

print("Hello,", name)
```

### Sample Input

```
राज
```

### Output

```
Hello, राज
```

### Explanation

- The user enters a Unicode string.
- Python stores the entered text correctly.
- The output displays the Unicode characters without modification.

---

## Example 6: Unicode String Length

**main.py**

```
text = "नमस्ते"

print(len(text))
```

### Output

```
6
```

### Explanation

- `len()` counts the number of Unicode characters in the string.
- `"नमस्ते"` contains six Unicode characters.
- The returned value is an integer.

---

## Example 7: Accessing Unicode Characters

**main.py**

```
text = "你好"

print(text[0])
print(text[1])
```

### Output

```
你
好
```

### Explanation

- Unicode strings support indexing just like ordinary strings.
- Each character can be accessed using its index.
- Python treats Unicode characters as string elements.

---

## Example 8: Combining Unicode Strings

**main.py**

```
greeting = "नमस्ते"
name = "राज"

print(greeting + " " + name)
```

### Output

```
नमस्ते राज
```

### Explanation

- Unicode strings can be concatenated.
- The space is added between the two strings.
- The result is a new Unicode string.

---

## Example 9: Checking the Data Type

**main.py**

```
text = "こんにちは"

print(type(text))
```

### Output

```
<class 'str'>
```

### Explanation

- Unicode strings are still normal Python strings.
- Their data type is `str`.
- Python 3 does not have a separate Unicode string type.

---

## Example 10: Mixing Different Languages

**main.py**

```
text = "Hello नमस्ते 你好"

print(text)
```

### Output

```
Hello नमस्ते 你好
```

### Explanation

- A single string can contain characters from multiple languages.
- Python stores all of them as Unicode.
- This makes multilingual applications easy to develop.

---

# Common Mistakes

### 1. Assuming Unicode Requires Special Syntax

**Incorrect**

```
text = "नमस्ते"

print(text)
```

### Incorrect Expectation

```
SyntaxError
```

### Actual Output

```
नमस्ते
```

**Reason**

Python 3 strings are Unicode by default.

---

### 2. Assuming Unicode Has a Different Data Type

**Incorrect**

```
text = "你好"

print(type(text))
```

### Incorrect Expectation

```
<class 'unicode'>
```

### Actual Output

```
<class 'str'>
```

**Reason**

Unicode strings are of type `str` in Python 3.

---

### 3. Assuming Emojis Cannot Be Stored

**Incorrect**

```
text = "😊"

print(text)
```

### Incorrect Expectation

```
Error
```

### Actual Output

```
😊
```

**Reason**

Emojis are valid Unicode characters.

---

### 4. Assuming Unicode Cannot Be Indexed

**Incorrect**

```
text = "नमस्ते"

print(text[0])
```

### Incorrect Expectation

```
IndexError
```

### Actual Output

```
न
```

**Reason**

Unicode strings support indexing just like other strings.

---

# Best Practices

- Store multilingual text directly as Unicode strings.
- Use meaningful variable names when working with Unicode data.
- Test applications using text from different languages when developing international software.
- Remember that Unicode strings support all normal string operations.
- Ensure your editor saves source files using UTF-8 encoding.

---

# Key Points to Remember

- Python 3 strings are Unicode by default.
- Unicode supports characters from almost every language.
- Emojis and special symbols are also Unicode characters.
- Unicode strings are of type `str`.
- Unicode strings support indexing, slicing, concatenation, and all standard string methods.
- No special syntax is required to create Unicode strings.
- Unicode makes Python suitable for multilingual applications.
