extract_msg.encoding.utils Module
Module contents
Internal utilities for extract_msg.encoding.
- extract_msg.encoding.utils.variableByteDecode(codecName: str, data, errors: str, decodeTable: Dict[int, str]) Tuple[str, int] [source]
Function for decoding variable-byte codecs that use one or two bytes per character.
Checks if a character is less than
0x80
, mapping it directly if so. Otherwise, it reads the next byte and combines the two before looking up the new value.- Parameters:
codecName – The name of the codec, used for error messages.
data – A bytes-like object to decode.
errors – The error behavior to use.
decodeTable – The mapping of values to use. Continuation bytes MUST be defined in the table, but SHOULD be set to None. This allows for the function to detect what bytes are valid for continuation.
- extract_msg.encoding.utils.variableByteEncode(codecName: str, data, errors: str, encodeTable: Dict[str, bytes]) Tuple[bytes, int] [source]
Function for encoding variable-byte codecs that use one or two bytes per character.
- Parameters:
codecName – The name of the codec, used for error messages.
data – A bytes-like object to decode.
errors – The error behavior to use.
encodeTable – The mapping of values to use.