forked from jordan-wright/email
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jordan-wright#147 Proper handling of utf-8 characters in reply-to hea…
…ders
- Loading branch information
Tarmo Randma
committed
Aug 16, 2021
1 parent
943e75f
commit 7c4c797
Showing
3 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ jobs: | |
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: auto | ||
steps: | ||
|
||
- name: Set up Go 1.x | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -397,6 +397,11 @@ func TestHeaderEncoding(t *testing.T) { | |
have: "Needs Encóding <[email protected]>, Only ASCII <[email protected]>", | ||
want: "=?utf-8?q?Needs_Enc=C3=B3ding?= <[email protected]>, \"Only ASCII\" <[email protected]>\r\n", | ||
}, | ||
{ | ||
field: "Reply-To", | ||
have: "Needs Encóding <[email protected]>, Only ASCII <[email protected]>", | ||
want: "=?utf-8?q?Needs_Enc=C3=B3ding?= <[email protected]>, \"Only ASCII\" <[email protected]>\r\n", | ||
}, | ||
{ | ||
field: "To", | ||
have: "Keith Moore <[email protected]>, Keld Jørn Simonsen <[email protected]>", | ||
|
@@ -523,6 +528,7 @@ func TestNonAsciiEmailFromReader(t *testing.T) { | |
ex := &Email{ | ||
Subject: "Test Subject", | ||
To: []string{"Anaïs <[email protected]>"}, | ||
ReplyTo: []string{"Anaïs <[email protected]>"}, | ||
Cc: []string{"Patrik Fältström <[email protected]>"}, | ||
From: "Mrs Valérie Dupont <[email protected]>", | ||
Text: []byte("This is a test message!"), | ||
|
@@ -532,6 +538,7 @@ func TestNonAsciiEmailFromReader(t *testing.T) { | |
Subject: =?UTF-8?Q?Test Subject?= | ||
From: Mrs =?ISO-8859-1?Q?Val=C3=A9rie=20Dupont?= <[email protected]> | ||
To: =?utf-8?q?Ana=C3=AFs?= <[email protected]> | ||
Reply-To: =?utf-8?q?Ana=C3=AFs?= <[email protected]> | ||
Cc: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <[email protected]> | ||
Content-type: text/plain; charset=ISO-8859-1 | ||
|
@@ -549,6 +556,9 @@ This is a test message!`) | |
if e.To[0] != ex.To[0] { | ||
t.Fatalf("Incorrect \"To\": %#q != %#q", e.To, ex.To) | ||
} | ||
if e.ReplyTo[0] != ex.ReplyTo[0] { | ||
t.Fatalf("Incorrect \"Reply-To\": %#q != %#q", e.ReplyTo, ex.ReplyTo) | ||
} | ||
if e.Cc[0] != ex.Cc[0] { | ||
t.Fatalf("Incorrect \"Cc\": %#q != %#q", e.Cc, ex.Cc) | ||
} | ||
|