Skip to content

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
  • ERROR_STYLE
  • BYTES_BRIGHTER
  • BYTES_DECODED
  • 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): The BytesMatch 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 Rich Text object (with highlighting).

method __init__

__init__(
    bytes_match: BytesMatch,
    encoding: str,
    failed_to_decode: bool = False,
    start_offset: int = 0,
    start_offset_label: str | None = None,
    was_force_decoded: bool = False
) → None

property bytes


This file was automatically generated via lazydocs.