/** * Charset decoding with an explicit, recorded fallback chain. * * Measured on the working corpus: about 14 percent of text parts declare something other than * utf-8, including iso-8859-1, iso-8859-15, windows-1257, windows-1252 and iso-2022-jp. A silent * fallback would corrupt those messages without anyone noticing, so every downgrade is reported * back to the caller. * * Chain: * 1. Normalise the declared label through libmime (handles aliases such as "unicode-1-1-utf-8"). * 2. Node's built in TextDecoder, which covers the WHATWG encoding set including the legacy * single byte and CJK encodings. * 3. libmime's iconv-lite backed decoder, which covers labels TextDecoder rejects (utf-7 and a * long tail of aliases). * 4. windows-1252, which cannot fail, flagged as a downgrade. */ export interface CharsetDecodeResult { text: string; charsetUsed: string; replacementChars: number; /** True when the declared charset could not be honoured. */ fellBack: boolean; } /** Normalise a raw charset label. Returns null when the label is empty or meaningless. */ export declare function normaliseCharset(label: string | null | undefined): string | null; /** * Decode a byte buffer using the declared charset, falling back predictably. * * @param buf raw bytes, already transfer decoded * @param declared charset label from the Content-Type header, or null when absent */ export declare function decodeCharset(buf: Buffer, declared: string | null): CharsetDecodeResult; //# sourceMappingURL=charset.d.ts.map