// atom
word, err = p.consumeAtom(false)
}
+
+ // RFC 2047 encoded-word starts with =?, ends with ?=, and has two other ?s.
+ if err == nil && strings.HasPrefix(word, "=?") && strings.HasSuffix(word, "?=") && strings.Count(word, "?") == 4 {
+ word, err = decodeRFC2047Word(word)
+ }
+
if err != nil {
break
}
return "", os.ErrorString("mail: missing word in phrase")
}
phrase = strings.Join(words, " ")
-
- // RFC 2047 encoded-word starts with =?, ends with ?=, and has two other ?s.
- if strings.HasPrefix(phrase, "=?") && strings.HasSuffix(phrase, "?=") && strings.Count(phrase, "?") == 4 {
- return decodeRFC2047Word(phrase)
- }
return phrase, nil
}
},
},
},
+ // RFC 2047, Section 8.
+ {
+ `=?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>`,
+ []*Address{
+ &Address{
+ Name: `André Pirard`,
+ Address: "PIRARD@vm1.ulg.ac.be",
+ },
+ },
+ },
}
for _, test := range tests {
addrs, err := newAddrParser(test.addrsStr).parseAddressList()