Does not detect encoding for files with EML extension

Hi,
When viewing EML files with the message body defined as "Content-Type: text/plain; charset=“iso-8859-9"”, some characters are displayed corrupted. The “GroupDocs.Viewer.Options.LoadOptions” class has the “DetectEncoding” property, but I guess it is not supported for EML files.

How can I detect the encoding of EML files?
or can I have it detected automatically during viewing?

Best regards.

@fsimsek

To address the issue of corrupted characters in EML files with specific encodings, you can manually set the encoding in the load options when using the GroupDocs.Viewer. The LoadOptions class allows you to specify the encoding, which can help in correctly displaying the content.

Here’s a code snippet that demonstrates how to set the encoding to UTF-8:

// Set the license path or omit the next two lines if not using a license
License license = new License();
license.SetLicense("GroupDocs.Viewer.lic");

var loadOptions = new LoadOptions();
loadOptions.Encoding = Encoding.UTF8; // Set the desired encoding

using (Viewer viewer = new Viewer("sample_mail.eml", loadOptions))
{
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources("page_{0}.html");
    viewer.View(viewOptions);
}

Currently, you need to specify the encoding manually, but it has been noted that this issue will be addressed in an upcoming release, which may provide automatic detection of encoding for EML files.

Best regards!

How can I detect the encoding of EML files?
Can I detect it using GroupDocs.MetaData ?

@fsimsek

Yes, the option DetectEncoding works for text files. Can you please share the sample EML file so we could reproduce the issue?