mojo
mojo copied to clipboard
[stdlib] Add utf8 safeguards, fix `chr` method, add unicode and utf16 parsing for `String`
Add utf8 safeguards, the second of many steps to fix #2842
fn chr(c: Int) -> String
function now returns a replacement character (�)
if the Unicode codepoint is invalid.
Added String.from_unicode(values: List[Int]) -> String
and
String.from_utf16(values: List[UInt16]) -> String
functions that return a String
containing the concatenated characters. If a Unicode codepoint
is invalid, the parsed String has a replacement character (�) in that index.