๐ Text Size Guide
Understand byte size under UTF-8 encoding
Characters โ Bytes
Many people assume "one character = one byte". Wrong. Under UTF-8:
- English letters, digits, punctuation โ 1 byte
- Chinese, Japanese, Korean โ 3 bytes
- Emoji โ 4 bytes
So ใไฝ ๅฅฝใ has 2 characters but 6 bytes. You can't use length to judge actual size.
Why Byte Size Matters
- API response size: estimate JSON payload volume
- localStorage quota: browsers limit ~5MB
- DB field length: VARCHAR byte vs char pitfalls
- Network transfer: estimate actual traffic
How to Calculate
Frontend: new Blob([str]).size or new TextEncoder().encode(str).length. Backend (Java): str.getBytes("UTF-8").length.
๐ Calculate text size
๐ Open Text Size Tool