# Function encoding_rs::mem::convert_utf8_to_utf16 [−] [src]

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

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 `u16`s written.

# Panics

Panics if the destination buffer is shorter than stated above.