mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-08-09 23:33:12 +00:00
Unknown charset labels (QQ Mail's RFC 1428 'unknown-8bit' placeholder, misspelled names, garbage encoded-word charsets) raised LookupError from bytes.decode — errors='replace' only guards decode errors, not a missing codec — aborting the whole fetch batch. UIDs are marked seen before the fetch, so the crash permanently dropped every message in the batch. - _safe_decode(): alias table (unknown-8bit→utf-8, gb2312/gbk→gb18030, ks_c_5601-1987→cp949, ...) then utf-8, then latin-1 last resort. - _decode_header_value(): wraps decode_header() so a malformed RFC 2047 header degrades to the raw string instead of crashing. - _extract_text_body(): all three decode sites now use _safe_decode. Fixes #35901, fixes #55381, fixes #55383.