]> Cypherpunks repositories - gostls13.git/commit
net/mail: use base64 encoding when needed in Address.String()
authorAlexandre Cesaro <alexandre.cesaro@gmail.com>
Tue, 20 Oct 2015 15:30:21 +0000 (17:30 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 2 Dec 2015 17:37:36 +0000 (17:37 +0000)
commit2cb265d16c611aae56fd3f3ce87279a1f52f925a
tree05aa38433462d6ff61bb9665c7bb7d83723891d8
parentb64b3a771320d95a4c9b8456e8de0e70702a0275
net/mail: use base64 encoding when needed in Address.String()

When the name of an Address contains non-ASCII characters,
Address.String() used mime.QEncoding to encode the name.

However certain characters are forbidden when an encoded-word is
in a phrase context (see RFC 2047 section 5.3) and these
characters are not encoded by mime.QEncoding.

In this case we now use mime.BEncoding (base64 encoding) so that
forbidden characters are also encoded.

Fixes #11292

Change-Id: I52db98b41ece439295e97d7e94c8190426f499c2
Reviewed-on: https://go-review.googlesource.com/16012
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/mail/message.go
src/net/mail/message_test.go