Getting exception when trying to load an EML with japanese characters

Hi,

I'm using Aspose.Email for Java 1.4. When trying to load an EML message that contains some japanese characters using static function

MailMessage msg = MailMessage.load(tempFile.getCanonicalPath(), MessageFormat.getEml());

I'm getting this error

java.lang.IllegalStateException: java.nio.charset.UnsupportedCharsetException: x-windows-50220
at com.aspose.email.private.e.d.j(Unknown Source)
at com.aspose.email.private.e.d.l(Unknown Source)
at com.aspose.email.private.e.d.a(Unknown Source)
at com.aspose.ms.System.IO.i.a(Unknown Source)
at com.aspose.ms.System.IO.i.(Unknown Source)
at com.aspose.ms.System.IO.i.(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.b(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.b(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.load(Unknown Source)
at com.test.OutlookFeeder.ProcessEmails(OutlookFeeder.java:618)
at com.test.FeederMain.main(FeederMain.java:86)
Caused by: java.nio.charset.UnsupportedCharsetException: x-windows-50220
at java.nio.charset.Charset.forName(Charset.java:428)

Any idea of how to solve this? I tried using the latest version of Aspose.Email for Java 1.4 (released on 08/2012) but it happens the same. Please let me know in case you need any extra information.

Thanks.

Hi,


Thank you for using Aspose.Email.

Well, as you are already using the latest version of Aspose.Email for Java v 2.0.0, so we would be in need of your sample EML file that causes this exception. Please provide us this EML file in order to reproduce the issue at our end and forward these details to our development team for further assistance.

Hi,

Thanks for the quick response. I attached an email message that causes this exception. All emails with japanese characters are causing it.

Also, please find below the last stack trace I got when this issue happened today using the newest version. Last stack trace I included in the original email was from the past version of Aspose.Email for java 1.4. It was the same encoding error.

java.lang.IllegalStateException: java.nio.charset.UnsupportedCharsetException: x-windows-50220
at com.aspose.email.private.e.d.j(Unknown Source)
at com.aspose.email.private.e.d.l(Unknown Source)
at com.aspose.email.private.e.d.a(Unknown Source)
at com.aspose.email.private.e.d.a(Unknown Source)
at com.aspose.email.private.e.d.a(Unknown Source)
at com.aspose.email.gh.a(Unknown Source)
at com.aspose.email.iV.a(Unknown Source)
at com.aspose.email.iV.(Unknown Source)
at com.aspose.email.cC.a(Unknown Source)
at com.aspose.email.HeaderCollection.a(Unknown Source)
at com.aspose.email.gk.c(Unknown Source)
at com.aspose.email.gk.a(Unknown Source)
at com.aspose.email.gk.b(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.load(Unknown Source)
at com.test.OutlookFeeder.ProcessEmails(OutlookFeeder.java:618)
at com.test.FeederMain.main(FeederMain.java:86)
Caused by: java.nio.charset.UnsupportedCharsetException: x-windows-50220
at java.nio.charset.Charset.forName(Charset.java:428)

Please let me know if any other thing is required. Thanks.

Alberto.

Hi Alberto,


Thanks for the feedback.

I tried to reproduce your mentioned issue at my end with the latest version of Aspose.Email for Java v 2.0.0 and jdk1.4, but was unable to get success. I have tried it using Eclipse IDE on my windows 7 OS. Can you please share your development environment details with us? This will help us in further investigation of the issue and assisting you further.

Hi Kashif,

I'm currently using Windows XP with Eclipse 3.3. Java version is 1.4 (jdk141_05). Not sure if rt.jar or charset.jar files on JRE libraries could be related to this issue. Please let me know any other details that might be useful to you. Thanks.

Alberto.

Hi Alberto,


Thank you for the feedback.

I am afraid, but again I was unable to reproduce your mentioned issue with Windows XP and JDK1.4. We are further investigating the issue in this regard and will update you here about our findings. Your patience in this regard is highly appreciated.

Hi Alberto,


Thanks for being patient for our further investigation.

I am afraid but this issue is not reproducible at our end. In our opinion, this issue should not occur with the latest version of Aspose.Email for Java v2.0.0. Can you please re-confirm to us if you are using Aspose.Email for Java v 2.0.0? It is available online on our release page HERE.

If the issue still persists, please provide us the stack trace again with the Aspose.Email for Java v2.0.0. We are sorry for the inconvenience you are facing.

Hi Kashif,

I'm using last version, aspose-email-2.0.0-jdk14.jar.

The Stack Trace I'm getting with this version is:

java.lang.IllegalStateException: java.nio.charset.UnsupportedCharsetException: x-windows-50220
at com.aspose.email.private.e.d.j(Unknown Source)
at com.aspose.email.private.e.d.l(Unknown Source)
at com.aspose.email.private.e.d.a(Unknown Source)
at com.aspose.email.ms.System.IO.i.a(Unknown Source)
at com.aspose.email.ms.System.IO.i.(Unknown Source)
at com.aspose.email.ms.System.IO.i.(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.b(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.b(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.(Unknown Source)
at com.aspose.email.MailMessage.a(Unknown Source)
at com.aspose.email.MailMessage.load(Unknown Source)
at com.bofa.lapi.feeder.OutlookFeeder.ProcessEmails(OutlookFeeder.java:618)
at com.bofa.lapi.feeder.OutlookFeeder.ProcessEmailReportLinks(OutlookFeeder.java:171)
at com.bofa.lapi.feeder.RRFeederMain.main(RRFeederMain.java:86)
Caused by: java.nio.charset.UnsupportedCharsetException: x-windows-50220
at java.nio.charset.Charset.forName(Charset.java:428)
... 17 more

Please help me with this issue, as it is causing some problems with some asian users. Thanks a lot.

Best regards,

Alberto.

Adding information on past email (where current Aspose version and exception stack trace was sent to you), email messages where exception raises have this kind of styles inside:

@font-face

{font-family:“MS 明朝”;

panose-1:2 2 6 9 4 2 5 8 3 4;}

@font-face

{font-family:“MS 明朝”;

panose-1:2 2 6 9 4 2 5 8 3 4;}

@font-face

{font-family:"@MS 明朝";

panose-1:2 2 6 9 4 2 5 8 3 4;}

All seems to be related to an encoding problem, as even not having japanese characters (but having this encodings) causes errors. Maybe sending emails from japanese Windows users or something like this could help you to replicate this issue. We are currently facing this issues with japanese users.

Please let me know any advances on this, as I’ve been asked for any status on this. Thanks in advance.

Best regards,

Alberto.

Hi Alberto,


Thank you for the feedback and sharing additional information.

We are investigating this issue based on the confirmed information you have provided. We will get back to you on this shortly. Your patience in this respect is highly appreciated.

Hi,

Thank you for being patient during our investigation.

Based on the exception details from the stack trace, we investigated this issue further and found that java.nio.charset.Charset.forName(“x-windows-50220”), an instance of sun.nio.cs.ext.MS50220, should return a charset instance. As you mentioned in your earlier post that you are using jdk141_05, this jdk doesn’t have sun.nio.cs.ext.MS50220 in charsets.jar. However, it is available in 1.4.2_14 and should be available in later versions as well.

You can test the availability of this charset at your current setup by runing:

Charset c = java.nio.charset.Charset.forName("x-windows-50220");

We recommend you to please upgrade your JDK to newer verison. You can download it from the download links available at: Java Archive Downloads - Java SE 1.4.

After upgrading JDK, run again the above command for verification. Thus, in our opinion, upgrading the JDK should and must solve this problem.Please let us know your feedback after upgrading your JDK version and testing again.

Hi Kashif,

Actually, this was good information. I changed my application to be compiled using java_1.4.2_10 instead of the older version of Java 1.4 I was using, and message loading worked with this small change.

Thanks a lot.

Alberto.

Hi Alberto,


You are welcome and please feel free to contact us if you have any other difficulty/query. We will try to assist you as soon as possible to get it solved.