Function html5ever::tendril::encoding_rs::mem::convert_utf8_to_utf16

source ·
pub fn convert_utf8_to_utf16(src: &[u8], dst: &mut [u16]) -> usize
Expand description

Converts potentially-invalid UTF-8 to valid UTF-16 with errors replaced with the REPLACEMENT CHARACTER.

The length of the destination buffer must be at least the length of the source buffer plus one.

Returns the number of u16s written.

§Panics

Panics if the destination buffer is shorter than stated above.