GIVEN
- .NET Core 2.2 project and Aspose.Email v19.4.0.
- an email (
.msg
file) in a non-UTF8 encoding (e.g. DOS-era win-1252)
WHEN calling
var mailMessage = MailMessage.Load(stream);
where the stream points to the non-UTF8 encoded email.
THEN it throws an exception:
System.NotSupportedException. Message=No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Source=Aspose.Email`
StackTrace:
at .(Object )
at .()
at .(Object , UInt32 )
at .()
at .(Object[] , Type[] , Type[] , Object[] )
at . (MapiMessage )
at Aspose.Email.MailMessage.(Stream , MsgLoadOptions )
at Aspose.Email.MailMessage.(Stream , LoadOptions )
at
MyProject.AsposeDocumentService.GetEmailMetaData(Stream stream) in C:\MyProject\AsposeDocumentService.cs:line 213