There are 2 issues on which I need more clarity.
1. When trying to load a .msg file (Unicode) in a simplified Chinese windows OS I get a error message saying
java.lang.IllegalArgumentException: ‘GBK’ is not a supported encoding
at com.aspose.email.private.e.d.b(Unknown Source)
at com.aspose.email.private.e.d.(Unknown Source)
2. Even on changing the java’s default file encoding by setting -Dfile.encoding to something other than GBK, say “GB18030”, on saving to mht format I see the mail headers show ‘?’ instead of chinese characters.
Attaching the code and the message file with which I tried. Please note this issue is reproducible when the OS locale is simplified Chinese.
Shyama:
There are 2 issues on which I need more clarity.
1. When trying to load a .msg file (Unicode) in a simplified Chinese windows OS I get a error message saying
java.lang.IllegalArgumentException: 'GBK' is not a supported encoding
at com.aspose.email.private.e.d.b(Unknown Source)
at com.aspose.email.private.e.d.(Unknown Source)
I have tried to re-produce this error here by installing Chinese language pack and then switched my OS to use the Chinese Language. I tried your code, but no error was produced and complete code was executed successfully.I will further discuss this issue with experts and try to re-produce the issue here. Whatever the outcome will be, I will share with you.
Shyama:
2. Even on changing the java's default file encoding by setting -Dfile.encoding to something other than GBK, say "GB18030", on saving to mht format I see the mail headers show '?' instead of chinese characters.
Attaching the code and the message file with which I tried. Please note this issue is reproducible when the OS locale is simplified Chinese.
This issue was re-generated successfully and I have logged a ticket NETWRKJAVA-33153 in our bug tracking system. As soon some feedback is received from development team, it will be notified to you immediately.
Hi Shyama,
Shyama:
1. When trying to load a .msg file (Unicode) in a simplified Chinese windows OS I get a error message saying
java.lang.IllegalArgumentException: ‘GBK’ is not a supported encoding
at com.aspose.email.private.e.d.b(Unknown Source)
at com.aspose.email.private.e.d.(Unknown Source)
java.nio.charset.IllegalCharsetNameException:
at java.nio.charset.Charset.checkName(Unknown Source)
at java.nio.charset.Charset.lookup2(Unknown Source)
at java.nio.charset.Charset.lookup(Unknown Source)
at java.nio.charset.Charset.defaultCharset(Unknown Source)
at sun.nio.cs.StreamEncoder.forOutputStreamWriter(Unknown Source)
at java.io.OutputStreamWriter.(Unknown Source)
at java.io.PrintStream.(Unknown Source)
at java.io.PrintStream.(Unknown Source)
at java.lang.System.initializeSystemClass(Unknown Source)
Locale aLocale = Locale.SIMPLIFIED_CHINESE;
Hi Malik,
Thank you for the response. With respect to the error,
java.lang.IllegalArgumentException: ‘GBK’ is not a supported encoding
at com.aspose.email.private.e.d.b(Unknown Source)
at com.aspose.email.private.e.d.(Unknown Source)
We see that only in Chinese windows OS. The java version used is “1.6.0_31” . Hope this helps. Please let me know what other information would help you.
One other question is does Aspose.Email require specific fonts to be installed to render Japanese or Chinese chracters when converting email to pdf?
Hi Shyama,
Hi Babar,
I see if unicode font like ‘Arial Unicode’ is not installed in the machine the mhtml does not render multibyte characters in the body of the mail. The problem seems to be in Aspose.email itself.
Hi Shyama,
Hi,
The issues you have found earlier (filed as NETWRKJAVA-33153;NETWRKJAVA-33164) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
Hi ,
I see that NETWRKJAVA-33169 is marked as not a bug. Can you please let us know the reason?
Would this mean that “Arial Unicode MS” has to be installed ? I see that installing other unicode fonts like code2000 or gnu unifont did not help.Can you please throw some light on usage of fonts in aspose?
Hi Shyama,
@Test(description = "Multibyte character problem ")
public void NETWRKJAVA_33169() {
String fileName = Path.combine(Path.getTempPath(), “NETWRKJAVA_33169_output.mhtml”);
String body = “コンピュータ”;
MailMessage message = new MailMessage();
message.setHtmlBody(body);
Assert.assertTrue(message.getHtmlBody().contains(body));
message.save(fileName, MailMessageSaveType.getMHtmlFromat());
MailMessage loadedMessage = MailMessage.load(fileName);
Assert.assertTrue(loadedMessage.getHtmlBody().contains(body));
}
I would want to reopen NETWRKJAVA-33153 as the header content has one character which is still corrupted.
Attaching the input mail and screenshot.
Hi Shyama,