Function encoding_c::encoding_for_label [] [src]

#[no_mangle]
pub unsafe extern fn encoding_for_label(label: *const u8,
                                        label_len: usize)
                                        -> *const Encoding

Implements the get an encoding algorithm.

If, after ASCII-lowercasing and removing leading and trailing whitespace, the argument matches a label defined in the Encoding Standard, const Encoding* representing the corresponding encoding is returned. If there is no match, NULL is returned.

The argument buffer can be in any ASCII-compatible encoding. It is not required to be UTF-8.

Undefined behavior

UB ensues if label and label_len don't designate a valid memory block.