ContentDisposition.Filename causing exception with unicode characters

Hi,

if i use a filename in ContentDisposition that contains unicode characters the Save (or more exactly the ContentDisposition.ToString()) method throws.

Aspose.Network Version 4.8.0.8

Sample code:

using (MailMessage message = new MailMessage())
{
Attachment attachment = new Attachment(new MemoryStream(), “€.pdf”);
attachment.ContentDisposition.FileName = “€.pdf”;
message.AddAttachment(attachment);
message.Save(new MemoryStream());
}

Result:

System.FormatException: An invalid character was found in the mail header.
at Aspose.Network.xe8b0369f54f4b3bc.x13248c0a655a378d(String x4a3f0a05c02f235f, StringBuilder xd07ce4b74c5774a7)
at Aspose.Network.Mime.ContentDisposition.ToString()
at Aspose.Network.Mime.ContentDisposition.PersistIfNeeded(HeaderCollection headers, Boolean forcePersist)
at Aspose.Network.Mime.xae9fad9e3ec8cb69.get_Headers()
at Aspose.Network.Mime.x83903e31fd6d37d2.Send(x7fdc1bfc45368624 writer)
at Aspose.Network.Mime.x99ba4fc54cd04c54.Send(x7fdc1bfc45368624 writer)
at Aspose.Network.Mime.x99ba4fc54cd04c54.Send(x7fdc1bfc45368624 writer)
at Aspose.Network.Mail.xd397bb1e465ce45e.x2de48dbd5ff873e9(x7fdc1bfc45368624 xbdfb620b7167944b, Boolean xf2345d49f064fe05)
at Aspose.Network.Mail.MailMessage.Save(Stream stream)

please provide a fix as soon as possible.

Thank you
with regards
Robert

Hi,

We are working on this issue. I will get back to you shortly.

Thanks,

By the way, if you want to set the name of the attachment, you don't need to set the ContentDisposition.FileName. You can create an Attachment instance with its name.

Thanks,

Hi, i know i can set the attachment name, but that is not the same. The Attachment name becomes part of the Content-Type header. The Filename property of the ContentDisposition object becomes a part of the Content-Disposition header.

cheers
Robert

Hi,

Please check the attached hotfix.

Thanks,

This solved the problem.
Thank you
Robert