Yoni Gibbs created MIME4J-327:
---------------------------------
Summary: Korean characters in eml file's "To" header not parsed
correctly when not base64-encoded
Key: MIME4J-327
URL: https://issues.apache.org/jira/browse/MIME4J-327
Project: James Mime4j
Issue Type: Bug
Affects Versions: 0.8.10
Environment: JDK 17, MacOS (also tried on Linux: same result)
Reporter: Yoni Gibbs
We are trying to parse an eml file where one of the recipients has a name
containing Korean characters. If the {{To:}} header is base64-encoded, it's
fine; if it's not base64-encoded, it fails to be read the name correctly.
Say we have an eml file with this header:
{{To: =?UTF-8?B?7Iuc7ZeY?= <[email protected]>}}
This parses fine.
But with the following header the name is parsed incorrectly:
{{To: "시험" <[email protected]>}}
We am using {{{}org.apache.james:apache-mime4j:0.8.10{}}}, and this is some
sample Java code to that produces the issue:
{{{{var is =
Main.class.getClassLoader().getResourceAsStream("not-base64-encoded.eml");}}}}
{{{{var parsed = new DefaultMessageBuilder().parseMessage(is);}}}}
{{{{var to = ((Mailbox) parsed.getTo().get(0)).getName();}}}}
{{{{assertEquals("시험", to);}}}}
Note that to generate an eml with the two different possible headers above we
are using {{{}org.eclipse.angus:angus-mail:2.0.2{}}}. The default behaviour
there is to generate the base64-encoded header. However if you set the
{{mail.mime.allowutf8}} property in the SMTP session to true then it creates
the not-base64-encoded header, which causes the problem for mime4j.
Does this look like a bug in mime4j? Or is there something we're not doing
correctly?
Thanks in advance!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)