Skip to content

Exception while loading outlook message *.msg #486

@bytew0lf

Description

@bytew0lf

Describe the bug
While trying to load a Outlook Message I get the following exception:

System.TypeInitializationException: The type initializer for 'MsgReader.Rtf.Font' threw an exception. ---> System.ArgumentException: 'Windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name') at System.Text.EncodingTable.InternalGetCodePageFromName(String name) at System.Text.EncodingTable.GetCodePageFromName(String name) at System.Text.Encoding.GetEncoding(String name) at MsgReader.Rtf.Font..cctor() --- End of inner exception stack trace --- at MsgReader.Rtf.Font.get_DefaultEncoding() at MsgReader.Rtf.Font.EncodingFromCodePage(Int32 codePage) at MsgReader.Rtf.Document.DeEncapsulateHtmlFromRtf(String rtf) at MsgReader.Outlook.Storage.Message.get_BodyHtml() at MsgReader.Outlook.Storage.Message.LoadStorage(Storage storage) at MsgReader.Outlook.Storage..ctor(String storageFilePath, FileAccess fileAccess) at MsgReader.Outlook.Storage.Message..ctor(String msgfile, FileAccess fileAccess)

Another Exception with another exported E-Mail
System.NotSupportedException: No data is available for encoding 950. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. at System.Text.Encoding.GetEncoding(Int32 codepage) at MsgReader.Outlook.Storage.get_InternetCodePage() at MsgReader.Outlook.Storage.get_MessageCodePage() at MsgReader.Outlook.Storage.Message.get_BodyRtf() at MsgReader.Outlook.Storage.Message.get_BodyHtml() at MsgReader.Outlook.Storage.Message.LoadStorage(Storage storage) at MsgReader.Outlook.Storage..ctor(String storageFilePath, FileAccess fileAccess) at MsgReader.Outlook.Storage.Message..ctor(String msgfile, FileAccess fileAccess) at CaseManager.Pages.Evidence.DetailsModel.BuildEmailPreviewHtml(String physicalPath, String extension)

This happens directly in this line
using var message = new MsgReader.Outlook.Storage.Message(physicalPath);

To Reproduce
Steps to reproduce the behavior:
Version: Microsoft® Outlook® for Microsoft 365 MSO (Version 2510 Build 16.0.19328.20266) 64-bit

  1. Export a Message from Microsoft Outlook with Drag&Drop to the Filesystem
  2. Try to load the message
  3. See error

Expected behavior
The Outlook message should be loaded and decoded so its content can be used further in the program.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Microsoft Edge
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions