james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukáš Vlček <lukas.vl...@gmail.com>
Subject Re: Switching from 0.6 to 0.7.1 - address parsing, CRLF issues
Date Sat, 17 Dec 2011 23:21:16 GMT
Hi again,

there is another difference between 0.6 and 0.7.1

It happens when I need to parse message with weird charset 'x-gbk'.

I added a new test case into my github repo for both 0.6 and 0.7.1 versions.
Basically the problem happens when I try to get Reader from the TextBody:

Message message = getMessage(....);
TextBody body = (TextBody) message.getBody();
body.getReader(); // here the exception is fired

It worked fine in 0.6 but it yields UnsupportedEncodingException in 0.7.1
which is quite unfortunate because I do not see way how to extract body
content from it in this case (as I need to get the Reader first).

Here are examples:
0.6
https://github.com/lukas-vlcek/mime4j-test/blob/backto06/src/test/java/org/mime4j/test/BasicTest.java#L134
0.7.1
https://github.com/lukas-vlcek/mime4j-test/blob/workaround/src/test/java/org/mime4j/test/BasicTest.java#L134

Any idea hot to deal with this situation?

Note, I understand that 'x-gbk' is unknown charset for JVM but even in such
case I was able to extract the body content by forcing 'gbk' charset
instead into my utility classes in 0.6, however, with 0.7.1 I am unable to
do it because the very basic body.getReader call fails... is there any
workaround how to get the body Reader and not to get the exception?

Regards,
Lukas

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message