3 ms·
> So using UCS-2 would actually work for almost everyone except maybe 1.5 billion people. One of the great things about using Rust is that I don't have to have
by rectang 6y ago
> So using UCS-2 would actually work for almost everyone except maybe 1.5 billion people.
One of the great things about using Rust is that I don't have to have this argument. There doesn't have to be a debate about whether we should invest in fixing subtly broken code. Rust string-handling which generally works for Europeans will also work for Chinese!
This isn't the fault of the languages which were designed for UCS-2 (then known just as "Unicode"). But the fact that Rust emerged after UTF-8's ascendance means that Rust's users mostly get to avoid the UCS-2/UTF-16 legacy tarpit.
- tsimionescu 6y ago> Rust string-handling which generally works for Europeans will also work for Chinese! I doubt that is any more true than Java. You can easily write code in Rust that assumes you can split a String anywhere and get two valid strings, that you can compute the length of a String and get information about how long the printed representation will be, that you can find a substring in that string by simply iterating through UTF-8 code points etc. All of these assumptions are about as wrong in UTF-8 Rust as they are in UTF-16 Java.
- deleted 6y ago[deleted]