pub unsafe fn convert_utf16le_to_latin1(
src: *const u16,
len: usize,
dst: *mut u8,
) -> usizeExpand description
Convert possibly broken UTF-16LE string into Latin1 string.
During the conversion also validation of the input string is done. This function is suitable to work with inputs from untrusted sources.
Returns the number of written code units; 0 if the input is not a valid UTF-16LE string
This function is not BOM-aware.
ยงSafety
srcanddstmust be non-null and properly aligned.srcmust be valid for reads oflen * size_of::<u16>()bytesdstmust be valid for writes ofcount * size_of::<u8>()bytes, where thecountis the number of code units (u8) after successful conversion.- The memory regions of
srcanddstmust not overlap.