UTF-8
The most used way to store Unicode text. Each character takes 1 to 4 bytes, and ASCII text stays the same.
Example
"niño" takes 5 bytes: 1 each for n, i and o, and 2 for "ñ". An emoji takes 4.
Test yourself: UTF-8
How letters are stored
An ASCII text file can be read as UTF-8 without changing anything.
UTF-8's first 128 characters take 1 byte and match ASCII: "HOLA" is the same 4 bytes, 72 79 76 65, in both.
How letters are stored
In UTF-8, the bytes after a character's first one always start with ___.
"ñ" is 11000011 10110001: the second byte starts with 10. That marks it as a continuation, not a new character.
How letters are stored
In a UTF-8 text, reaching character number i means walking from the start: it's O(___).
Since each character takes 1 to 4 bytes, character 500 could be at byte 500 or byte 2,000: you have to count one by one.
0/3
â–¶ Play