3 ms·
Me too, how is case conversion perfectly done in modern languages such as Zig [1], Rust, or Swift? [1] Ended up looking at https://github.com/JakubSzark/zig-st
by wslh 2y ago
Me too, how is case conversion perfectly done in modern languages such as Zig [1], Rust, or Swift?
[1] Ended up looking at https://github.com/JakubSzark/zig-string https://github.com/JakubSzark/zig-string
- steveklabnik 2y agoIn Rust, the APIs are clear if they're ASCII only or unicode aware. https://doc.rust-lang.org/stable/std/primitive.str.html#method.to_lowercase https://doc.rust-lang.org/stable/std/primitive.str.html#meth... > ‘Lowercase’ is defined according to the terms of the Unicode Derived Core Property Lowercase. https://doc.rust-lang.org/stable/std/primitive.str.html#method.to_ascii_lowercase https://doc.rust-lang.org/stable/std/primitive.str.html#meth... > ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged. Now, "perfectly" is very strong. For example, the Turkish i problem. That is not solved. But 99% of Unicode stuff is handled correctly by default.
- oguz-ismail 2y ago> 99% of Unicode stuff Does that include context-dependent conversion rules like o'reilly -> O'Reilly?
- PaulDavisThe1st 2y agothat is neither up-casing nor-downcasing, but (de)capitalization, which is a significantly more complex task (which ultimately requires up- or down-casing, but a whole lot more before then).
- oguz-ismail 2y agoSo it doesn't. If Unicode doesn't cover non-trivial forms of case-folding, 99% of Unicode doesn't mean anything.
- PaulDavisThe1st 2y agoI am not aware of a Unicode concept of "the latin letter o followed by an apostrophe followed by another latin letter". Unicode would identify the glyphs for such a concept, but I don't see how Unicode is involved in this in anyway as far the process of deciding what "capitalized o'reilly" means.
- steveklabnik 2y agoSort of, see the Greek example elsewhere in this thread. I don’t think that specific situation is part of Unicode though.