From e88b8eeac27ec3a829a4622c861a9018b9baa329 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sun, 3 May 2015 19:17:00 +0200 Subject: Fixed parsing of UTF8 email addresses (RFC-2047 local part + IDNA domain name). --- tests/parser/emailAddressTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/parser/emailAddressTest.cpp') diff --git a/tests/parser/emailAddressTest.cpp b/tests/parser/emailAddressTest.cpp index 4916aaa9..2de401a9 100644 --- a/tests/parser/emailAddressTest.cpp +++ b/tests/parser/emailAddressTest.cpp @@ -40,6 +40,7 @@ VMIME_TEST_SUITE_BEGIN(emailAddressTest) VMIME_TEST(testParseSpecialChars) VMIME_TEST(testParseCommentInLocalPart) VMIME_TEST(testParseCommentInDomainPart) + VMIME_TEST(testParseRFC2047EncodedLocalPart) VMIME_TEST(testGenerateSpecialChars) VMIME_TEST_LIST_END @@ -198,6 +199,21 @@ VMIME_TEST_SUITE_BEGIN(emailAddressTest) VASSERT_EQ("4/domain", "example.com", eml4.getDomainName()); } + void testParseRFC2047EncodedLocalPart() + { + vmime::emailAddress eml1("=?utf-8?Q?Pel=C3=A9?=@example.com"); + VASSERT_EQ("1/local", "Pelé", eml1.getLocalName()); + VASSERT_EQ("1/domain", "example.com", eml1.getDomainName()); + + vmime::emailAddress eml2("=?utf-8?B?55Sy5paQ?=@xn--5rtw95l.xn--wgv71a"); + VASSERT_EQ("2/local", "甲斐", eml2.getLocalName()); + VASSERT_EQ("2/domain", "黒川.日本", eml2.getDomainName()); + + vmime::emailAddress eml3("=?utf-8?B?55Sy5paQ?=@xn--5rtw95l.com"); + VASSERT_EQ("3/local", "甲斐", eml3.getLocalName()); + VASSERT_EQ("3/domain", "黒川.com", eml3.getDomainName()); + } + void testGenerateASCII() { VASSERT_EQ("email 1", "local@domain", vmime::emailAddress("local", "domain").generate()); -- cgit v1.2.3