#[no_mangle]
pub unsafe extern "C" fn encoding_new_decoder_with_bom_removal(
    encoding: *const Encoding
) -> *mut Decoder
Expand description

Allocates a new Decoder for the given Encoding on the heap with BOM removal and returns a pointer to the newly-allocated Decoder.

If the input starts with bytes that are the BOM for this encoding, those bytes are removed. However, the decoder never morphs into a decoder for another encoding: A BOM for another encoding is treated as (potentially malformed) input to the decoding algorithm for this encoding.

Once the allocated Decoder is no longer needed, the caller MUST deallocate it by passing the pointer returned by this function to decoder_free().

Undefined behavior

UB ensues if the argument is NULL.