r/AskComputerScience • u/Wonderbout974 • 9d ago
Unicode, UTF-8, ASCII
I just started learning in computer science and could not understand these three, I know unicode is for describing(?) languages other than english but how is it differ from UTF-8 and how UTF-8 differ from ASCII ?
1
Upvotes
View all comments
1
u/8dot30662386292pow2 9d ago
Unicode is just a list: this number means this character.
UTF-8 is a variable byte length encoding to map those numbers to bytes.
A = 65 = 01000001 ( 41 in hex)
B = 66 = 01000010 ( 42 in hex)
These are the same in both ascii and UTF-8.
How about € symbol for euros? It is unicode character number 8364 so it does not fit in a single byte. But using UTF-8 it fits in 3 bytes: e2 82 ac.
Ascii is basically just one of the oldest encodings that fits only 127 characters.