3 ms·
Code points are not bytes.
by foolswisdom 3y ago
Code points are not bytes.
- saghm 3y agoSure, but if you're insisting that the string be represented as one byte per character, you end up with the exact same properties with "array of code points" and "array of bytes"
- bruce511 3y agoSort-of, but no, because code points are not characters. There's a big difference between "get the 5th code point" and "get the 5th character". Because multiple code points can be used in a single character, it not possible to do random-character-access in a unicode-encoded string.
- foolswisdom 3y agoNo, it's impossible to do random access to retrieve a character, if you are dealing with code points, because code points do not have a fixed byte size. I thought this a good intro <https://tonsky.me/blog/unicode/ https://tonsky.me/blog/unicode/>.