module decoding_attempt
Class to manage attempting to decode a chunk of bytes into strings with a given encoding.
Global Variables
- byteorder
- ENCODINGS_TO_ATTEMPT
- SINGLE_BYTE_ENCODINGS
- UTF_8
- ALERT_STYLE
- BYTES_BRIGHTER
- BYTES_BRIGHTEST
- BYTES_NO_DIM
- GREY_ADDRESS
class DecodingAttempt
Manages the process of attempting to decode a chunk of bytes into a string using a specified encoding.
This class tries to decode the bytes using the provided encoding, handling both standard and custom decoding strategies (including multi-byte encodings and forced decoding attempts). It tracks the outcome, highlights the decoded output, and provides information about the decoding process.
Attributes:
bytes
(bytes): The bytes (including context) to decode.bytes_match
(BytesMatch): TheBytesMatch
object containing match and context info.encoding
(str): The encoding to attempt.encoding_label
(str): Label for the encoding (may include offset info).start_offset
(int): Byte offset used for decoding (for multi-byte encodings).start_offset_label
(Optional[str]): String label for the offset, if used.was_force_decoded
(bool): True if a forced decode was attempted.failed_to_decode
(bool): True if decoding failed.decoded_string
(Text): The decoded string as a RichText
object (with highlighting).
method __init__
__init__(bytes_match: 'BytesMatch', encoding: str) → None
Initialize a DecodingAttempt
for a specific encoding
on a given BytesMatch
.
Args:
bytes_match
(BytesMatch): TheBytesMatch
object containing the bytes to decode and match metadata.encoding
(str): The encoding to attempt for decoding the bytes.
This file was automatically generated via lazydocs.