📄8-bit Unicode Transformation Format (UTF-8)
Also known as UTF-8, UTF8
The code that nearly all sites use. It has each language and emoji.
Think of it like
Think of it like one code book for every land. It has all their letters, and emoji too.
Example
Emma's shop shows names in English, Persian and Greek on one page. Because the page is UTF-8, every name looks right.
Why it matters
With UTF-8 in all places, names, signs and every language just work.
Definition
Example code
python
print(len("A".encode("utf-8"))) # 1
print(len("é".encode("utf-8"))) # 2
print(len("😀".encode("utf-8"))) # 4Common mistake
Key takeaways
- 1Every language. Plus emoji and symbols.
- 21 to 4 bytes. English letters stay at 1.
- 3The safe default. Pick it unless told otherwise.