I add x-gbk for jdk7, so i can use Charset.forName("x-gbk") in my program.
But when i add msg or eml to PST, it's show the following exception ( aspose-email-3.6.0)
PS. the attach file includ test.msg with x-gbk encoding and jcharset.jar for x-gbk, other encoding.
the same as aspose-email.3.5.0 bug fix NETWRKJAVA-33315 GBK is not a supported encoding,
Exception in thread "main" com.aspose.email.ms.System.IllegalArgumentException: 'x-gbk' is not a supported encoding
at com.aspose.email.private.h.d.b(Unknown Source)
at com.aspose.email.nz.e(Unknown Source)
at com.aspose.email.MailAddress.(Unknown Source)
at com.aspose.email.jy.b(Unknown Source)
at com.aspose.email.MailAddressCollection.b(Unknown Source)
at com.aspose.email.MailAddressCollection.a(Unknown Source)
at com.aspose.email.gj.a(Unknown Source)
at com.aspose.email.HeaderCollection.a(Unknown Source)
at com.aspose.email.od.c(Unknown Source)
at com.aspose.email.od.a(Unknown Source)
at com.aspose.email.od.b(Unknown Source)
at com.aspose.email.MailMessage.f(Unknown Source)
at com.aspose.email.MailMessageInterpretor.loadMessageHeader(Unknown Source)
at com.aspose.email.MailMessageInterpretor.interpret(Unknown Source)
at EmlToPST.msgToEml(EmlToPST.java:65)
at EmlToPST.main(EmlToPST.java:43)
public void msgToEml(String msgFile, String emiFile) {
// Open Outlook Message files
MapiMessage mapi = MapiMessage.fromFile(msgFile);
System.out.println("Unicode ok:" + mapi.isStoreUnicodeOk());
MailMessageInterpretorFactory.getInstance()
.getIntepretor(mapi.getMessageClass()).interpret(mapi) <----- exeption here
.save(emiFile, MessageFormat.getEml());
System.out.println("Write eml successful...");
}
Another code:
MailMessageLoadOptions options = new MailMessageLoadOptions();
options.setMessageFormat(MessageFormat.getEml());
options.setFileCompatibilityMode(FileCompatibilityMode.AllowCROnly);
options.setPrefferedTextEncoding(Charset.forName("x-gbk"));
MailMessage eml = MailMessage.load(emlFile, <--- exception here
options);