2 ms·
> UTF-32 code units are Unicode code points. They’re not. UTF-32 code units have a 1:1 mapping to USVs, surrogates are not valid. > It is wrong to present the
by masklinn 3y ago
> UTF-32 code units are Unicode code points.
They’re not. UTF-32 code units have a 1:1 mapping to USVs, surrogates are not valid.
> It is wrong to present them as equally arbitrary concepts.
Is it? It’s not like they’re any more useful. Arguably less so, UTF-16 is at least a somewhat common storage medium.
- xeeeeeeeeeeenu 3y ago>They’re not. UTF-32 code units have a 1:1 mapping to USVs, surrogates are not valid. This is true, although very pedantic and irrelevant to the point of my comment. The distinction only matters when you're dealing with ill-formed strings. BTW, Python strings can store surrogates. >Is it? It’s not like they’re any more useful. Arguably less so, UTF-16 is at least a somewhat common storage medium. If you aren't directly dealing with UTF-16, UTF-16 code units aren't useful at all. Code points/USVs, OTOH, are the building blocks of Unicode strings and various Unicode algorithms operate on them. They're low-level, but not useless.