Skip to main content

replacement_utf8

Function replacement_utf8 

Source
pub fn replacement_utf8(bytes: &[u8]) -> Vec<u8> ⓘ
Expand description

Decode bytes as UTF-8 with one U+FFFD per maximal ill-formed subpart and no BOM removal (the WHATWG decoder with replacement error handling).

The result is always valid UTF-8. Well-formed input is returned unchanged, so valid text costs one validation pass and one copy.