Documentation
    Preparing search index...

    Interface TextDecoderOptions

    Configuration options for MUtf8Decoder.

    interface TextDecoderOptions {
        fatal?: boolean;
        ignoreBOM?: boolean;
    }
    Index

    Properties

    Properties

    fatal?: boolean

    Controls error handling behavior when invalid Modified UTF-8 byte sequences are encountered.

    When true, the decoder throws a TypeError immediately upon encountering invalid bytes. When false, invalid sequences are replaced with the Unicode replacement character (U+FFFD).

    false

    const decoder = new MUtf8Decoder("mutf-8", { fatal: true });
    const invalidBytes = new Uint8Array([0xFF, 0xFE]);

    try {
    decoder.decode(invalidBytes); // Throws TypeError
    } catch (error) {
    console.error("Invalid MUTF-8 data:", error.message);
    }
    ignoreBOM?: boolean

    Whether to ignore the Byte Order Mark (BOM) at the beginning of the input.

    When false, a BOM (0xEF 0xBB 0xBF) at the start of the input is treated as a zero-width non-breaking space character. When true, the BOM is silently ignored and not included in the decoded output.

    false

    BOMs are uncommon in Modified UTF-8 data since it's primarily used internally by Java, but this option provides compatibility when processing mixed encoding data.