This is required for Unicode Collation tests which includes invalid unicode strings. I haven't read the algorithm, but is it fine to just do char::from_u32(n).unwrap_or('\u{FFFD}')?
None of the APIs accept anything other than str or char, so there is no way of providing invalid unicode to this crate. Using the replacement character is one typically-acceptable way of working with that.
This is required for Unicode Collation tests which includes invalid unicode strings. I haven't read the algorithm, but is it fine to just do
char::from_u32(n).unwrap_or('\u{FFFD}')
?