开发者

JavaMail Recipients - encoding problem?

开发者 https://www.devze.com 2023-04-04 03:52 出处:网络
I have small problem with JavaMail. Sometimes method getRecipients from class Message returns weird thing, a part of mycode:

I have small problem with JavaMail. Sometimes method getRecipients from class Message returns weird thing, a part of mycode:

Message开发者_StackOverflow社区 m = parent.getAgent().getMessages()[size-row-1];
m.getRecipients(Message.RecipientType.TO)[0].toString();

for some messages I have proper value like:

Pracuj.pl <pracuj@emails.pracuj.pl>

while some are like:

=?ISO-8859-2?Q?Jakas_Nazwa?= <jakas_nazwa@costam.pl>

Any idea what might be the problem? Maybe coding of Polish chars (ISO 8859-2)?


It's definitely an encoding issue. Try calling MimeUtility#decodeText on the returned recipient string.

0

精彩评论

暂无评论...
验证码 换一张
取 消