encoding_rs::mem

Function convert_utf16_to_str

source
pub fn convert_utf16_to_str(src: &[u16], dst: &mut str) -> usize
Expand description

Converts potentially-invalid UTF-16 to valid UTF-8 with errors replaced with the REPLACEMENT CHARACTER such that the validity of the output is signaled using the Rust type system.

The length of the destination buffer must be at least the length of the source buffer times three.

Returns the number of bytes written.

ยงPanics

Panics if the destination buffer is shorter than stated above.