Karta. Mail. Charset
(Karta v1.0.0)
Converts text in the charsets that make up nearly all mail to UTF-8, in pure Elixir.
utf-8(alsoutf8): returned as is when valid.us-ascii(and no charset at all): ASCII as is. Mail labelled ASCII that carries 8-bit text is common; it is read as UTF-8 when valid and as Windows-1252 otherwise.iso-8859-1(and its aliases) andwindows-1252: decoded as Windows-1252, the superset that mail labelled ISO-8859-1 nearly always is (as web browsers do).
Any other charset returns {:error, :unsupported_charset}; callers keep
the bytes and the label. No conversion goes through a C library.