Function encoding_c::encoding_for_bom
[−]
[src]
#[no_mangle]pub unsafe extern fn encoding_for_bom(buffer: *const u8,
buffer_len: *mut usize)
-> *const Encoding
Performs non-incremental BOM sniffing.
The argument must either be a buffer representing the entire input stream (non-streaming case) or a buffer representing at least the first three bytes of the input stream (streaming case).
Returns UTF_8_ENCODING
, UTF_16LE_ENCODING
or UTF_16BE_ENCODING
if the
argument starts with the UTF-8, UTF-16LE or UTF-16BE BOM or NULL
otherwise. Upon return, *buffer_len
is the length of the BOM (zero if
there is no BOM).
Undefined behavior
UB ensues if buffer
and buffer_len
don't designate a valid memory block.