Closed
Description
Behold!
#[test]
fn liar_liar_pants_on_fire() {
use std::ascii::AsciiExt;
assert_eq!("café".to_ascii_uppercase(), "CAFÉ");
assert_eq!("café".to_ascii_uppercase(), "CAFé");
assert_eq!("CAFÉ".to_ascii_lowercase(), "café");
assert_eq!("CAFÉ".to_ascii_lowercase(), "cafÉ");
}
This is obviously silly. The problem is that this is running an ASCII-only operation on Unicode strings without actually dealing with their Unicode-ness.
These functions should either correctly deal with grapheme clusters (by ignoring them since they're not in ASCII), or document that it does not correctly handle grapheme clusters, preferably with an example (like the above).
(Actually having a standard Ascii
type would be even more muchly preferable, but I suspect that's way out of scope.)
Metadata
Metadata
Assignees
Labels
No labels