This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-mime4j.git
The following commit(s) were added to refs/heads/master by this push: new 85995590 MIME4J-327 LenientAddressParser now handles UTF-8 (#104) 85995590 is described below commit 85995590ad6700cc8bf7a3b8462ce87843dab5bd Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Tue May 7 15:05:49 2024 +0200 MIME4J-327 LenientAddressParser now handles UTF-8 (#104) Huge thanks to Chung dae hyun for reporting the issue and writing the test Huge thanks to @twn for fixing utf-8 handling in the first place and fixing up the test --- .../mime4j/field/address/LenientAddressBuilderTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java b/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java index 78535802..a9d59642 100644 --- a/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java +++ b/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java @@ -108,6 +108,20 @@ public class LenientAddressBuilderTest { Assert.assertEquals("=?utf-8?Q?Dupont,_Gr=C3=A9goire", mailbox.getName()); } + @Test // MIME4J-327 + public void testNameUTF8Support() throws Exception { + String s = "\"시험\" <koreant...@example.com>"; + ByteSequence raw = ContentUtil.encode(s); + ParserCursor cursor = new ParserCursor(0, raw.length()); + + Address address = parser.parseAddress(raw, cursor, RawFieldParser.INIT_BITSET(',')); + Assert.assertNotNull(address); + Assert.assertTrue(address instanceof Mailbox); + Mailbox mailbox = (Mailbox) address; + Assert.assertEquals("시험", mailbox.getName()); + Assert.assertEquals("koreant...@example.com", mailbox.getAddress()); + } + @Test public void shouldTolerateMalformedEncoding() throws Exception { String s = "\"=?windows-1251?B?onsonsmekqixrbahkinyv?=\" <atfi...@louisphaethon.co.ua>"; --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org