Use the RFC822* header fields, only when the actual header fields are
MIME-encoded. If any RFC822* header field is a MIME-encoded UTF-8 string, then set the (new) auxattr MSG_HFIELDS_UTF8 flag. This will be used (soon, hopefully) to display UTF-8 encoded header fields to users. There's a gotchas here: - MIME-encoded header fields with other non-ASCII/8-bit charsets (e.g. CP437, ISO-8859) are still stored "as decoded", though the MSG_HFIELDS_UTF8 flag may be set *later* (which would be weird), resulting in a mixture of valid and invalid UTF-8 header fields. One solution would be to UTF-8-transcode all the non-UTF-8 header fields if *any* of them are UTF-8, but we wouldn't know which charset to translate *from*. Assuming CP437 isn't going to be correct 100% of the time - so punt for now and deal with it at display time. e.g. if the MSG_HFIELD_UTF8 auxattr flag is set, but an hfield contains invalid UTF-8 data, don't display as UTF-8 (e.g. treat as CP437). We don't have translations for other charsets (e.g. ISO-8859) setup yet anyway.
Showing with 87 additions and 41 deletions