Function std::str::from_utf8_lossy
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a>
Converts a vector of bytes to a new utf-8 string. Any invalid utf-8 sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
Example
let input = bytes!("Hello ", 0xF0, 0x90, 0x80, "World"); let output = std::str::from_utf8_lossy(input); assert_eq!(output.as_slice(), "Hello \uFFFDWorld");