extract_msg.encoding package
Submodules
extract_msg.encoding.utils module
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.
Module contents
File for handling specialized encoding tasks or information.
- extract_msg.encoding.lookupCodePage(id_: int) str[source]
Converts an encoding id into it’s name.
- Raises:
UnknownCodepageError – The code page was not recognized.
UnsupportedEncodingError – The code page was recognized, but no encoding exists in the environment with support for it.