Function widestring::decode_utf32_lossy[][src]

pub fn decode_utf32_lossy<I>(
    iter: I
) -> DecodeUtf32Lossy<<I as IntoIterator>::IntoIter>
Notable traits for DecodeUtf32Lossy<I>
impl<I> Iterator for DecodeUtf32Lossy<I> where
    I: Iterator<Item = u32>, 
type Item = char;
where
    I: IntoIterator<Item = u32>, 
Expand description

Creates a lossy decoder iterator over the possibly ill-formed UTF-32 encoded code points in iter.

This is equivalent to decode_utf32 except that any invalid UTF-32 values are replaced by U+FFFD REPLACEMENT_CHARACTER (�) instead of returning errors.

Examples

use widestring::decode_utf32_lossy;

// 𝄞mus<invalid>ic<invalid>
let v = [
    0x1D11E, 0x6d, 0x75, 0x73, 0xDD1E, 0x69, 0x63, 0x23FD5A,
];

assert_eq!(
decode_utf32_lossy(v.iter().copied()).collect::<String>(),
"𝄞mus�ic�"
);