Skip to content

3.16.0-ci20260911137

@alpapad alpapad tagged this 11 Sep 19:38
* fix: support utf-7 and legacy encodings in email parsing

Register CodePagesEncodingProvider to enable legacy code page encodings
(ISO-8859-8, Windows-1252, etc.) which are commonly used in older email
clients and are not available by default in .NET 5+.

Add Utf7EncodingProvider and Utf7WrapperEncoding to re-enable UTF-7
decoding for legacy email messages. .NET 9+ blocks Encoding.GetEncoding(65000)
and Encoding.GetEncoding("utf-7") before consulting registered providers.
The workaround registers a custom encoding that reports CodePage=65002 (a
private-use value not blocked by .NET). MimeKit caches utf-7→65002 and
subsequent codepage lookups are intercepted by the provider, delegating
actual encoding/decoding to the still-functional Encoding.UTF7 instance.

* test: verify legacy encodings in MIME messages

---------

Co-authored-by: alpapad <a.papadakis@eshare.com>
Co-authored-by: Rob Wood <rob@rnwood.co.uk>
Assets 2
Loading