#[no_mangle]
pub unsafe extern "C" fn encoding_mem_convert_latin1_to_utf8(
src: *const u8,
src_len: usize,
dst: *mut u8,
dst_len: usize,
) -> usize
Expand description
Converts bytes whose unsigned value is interpreted as Unicode code point (i.e. U+0000 to U+00FF, inclusive) to UTF-8.
The length of the destination buffer must be at least the length of the source buffer times two.
Returns the number of bytes written.
§Panics
Panics if the destination buffer is shorter than stated above.
§Safety
Note that this function may write garbage beyond the number of bytes
indicated by the return value, so using a &mut str
interpreted as
&mut [u8]
as the destination is not safe. If you want to convert into
a &mut str
, use convert_utf16_to_str()
instead of this function.
§Undefined behavior
UB ensues if src
and src_len
don’t designate a valid memory block, if
src
is NULL
, if dst
and dst_len
don’t designate a valid memory
block, if dst
is NULL
or if the two memory blocks overlap. (If
src_len
is 0
, src
may be bogus but still has to be non-NULL
and
aligned. Likewise for dst
and dst_len
.)