mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 22:14:40 +03:00
recognize more charsets than utf-8/iso-8859-1/us-ascii when parsing message headers with address
as they occur in From/To headers, for example: "From: =?iso-8859-2?Q?Krist=FDna?= <k@example.com>". we are using net/mail to parse such headers. most address-parsing functions in that package will only decode charsets utf-8, iso-8859-1 and us-ascii. we have to be careful to always use net/mail.AddressParser with a WordDecoder that understands more that the basics. for issue #204 by morki, thanks for reporting!
This commit is contained in:
@ -489,7 +489,12 @@ func parseEnvelope(log mlog.Log, h mail.Header) (*Envelope, error) {
|
||||
|
||||
func parseAddressList(log mlog.Log, h mail.Header, k string) []Address {
|
||||
// todo: possibly work around ios mail generating incorrect q-encoded "phrases" with unencoded double quotes? ../rfc/2047:382
|
||||
l, err := h.AddressList(k)
|
||||
v := h.Get(k)
|
||||
if v == "" {
|
||||
return nil
|
||||
}
|
||||
parser := mail.AddressParser{WordDecoder: &wordDecoder}
|
||||
l, err := parser.ParseList(v)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user