emersion / go-message

✉️ A streaming Go library for the Internet Message Format and mail messages
MIT License
387 stars 111 forks source link

RFC 2047 (Non-ASCII Text in message headers) #98

Closed grmat closed 4 years ago

grmat commented 4 years ago

Hi,

running the example in the go-imap wiki, I've seen that my name (example: "Nameß") in the From: field looks like

=?utf-8?q?Name=C3=9F?=

It seems like this is defined in https://tools.ietf.org/html/rfc2047 (section 2 and 4.2) as "similar to quoted-printable".

in address.go, the documentation is:

// String formats the address as a valid RFC 5322 address. If the address's name
// contains non-ASCII characters the name will be rendered according to
// RFC 2047.

Now I'm not sure if I my assumption is correctl but shouldn't "rendered according to RFC 2047" mean that the string is decoded by the lib? Or does it imply that it will remain encoded and I have to do the decoding on my side?

emersion commented 4 years ago

The mail.Address fields are decoded, but the value returned by the String method is encoded.