Java Aspose 19.6 Extracted EML attachments with non-English file names fail to save (FileNotFoundException)

Aspose Team,

Using the Java Aspose 19.6 email libraries, we’re trying to extract the attachments from an EML and save the attachments with their given names. However, when the attachment name contains non-English characters, we’re seeing the Aspose attachment save API method throw a “FileNotFoundException”.

Here’s a sample bit of code meant to show the relevant pieces:

Path filePath = getFilePath(); // input EML file with attachment (see attached sample file)
Path destFolderPath = getDestinationPath();

// Instantiate a mail message object to load the EML file from disk
MailMessage msg = MailMessage.load(filePath.toString());

for (int i = 0; i < msg.getAttachments().size(); i++) {
Attachment attachment = msg.getAttachments().get_Item(i);
String fileName = attachment.getName();
File file = new File(destFolderPath.toFile(), fileName);
try {
attachment.save(file.toString());
} catch (FileNotFoundException ex) {
Logger.Log(“Aspose failed to save attachment '” + fileName + " to " + file);
}
}
O.PC.00000780.zip (2.7 KB)

I’ve attached an EML file that exhibits the problem that we’re seeing. Please advise.

Thanks for your help.
Jerry

@jmuth,

I have worked with sample file shared by you and have been able to observe the issue specified. An issue with ID EMAILJAVA-34680 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be resolved.

Mudassir,

Thank you for the prompt reply and for filing a ticket on our behalf. We appreciate the help and look forward to a timely resolution.

Jerry

@jmuth,

You are welcome. We will share the good news with you as soon as the issue will be fixed.