Skip to content
Permalink
Browse files
MIME4J-253 fix parsing encoded local part (#65)
  • Loading branch information
t4nmoy committed Nov 22, 2021
1 parent d6a2db2 commit 41b9ab33f0de55ea514b6a0c7c813510fbdd11d1
Showing 2 changed files with 7 additions and 1 deletion.
@@ -184,7 +184,7 @@ Mailbox parseMailboxAddress(

private Mailbox createMailbox(final String localPart) {
if (localPart != null && localPart.length() > 0) {
return new Mailbox(null, null, localPart, null);
return new Mailbox(null, null, DecoderUtil.decodeEncodedWords(localPart, this.monitor), null);
} else {
return null;
}
@@ -215,6 +215,12 @@ public void testParseMailboxEncoded() throws ParseException {
Assert.assertEquals("localhost.localdomain", mailbox1.getDomain());
}

@Test
public void testParseMailboxEncodedLocalPart() throws ParseException {
Mailbox mailbox1 = parser.parseMailbox("=?utf-8?B?IkvDpXJlIFPDpnRyZSIgPGtzQGRvbWFpbi5jb20+?=");
Assert.assertEquals("\"Kåre Sætre\" <ks@domain.com>", mailbox1.getLocalPart());
}

@Test
public void testParseMailboxNonASCII() throws Exception {
Mailbox mailbox1 = parser.parseMailbox(

0 comments on commit 41b9ab3

Please sign in to comment.