Encoding

FileFormatInfo.Encoding property

Gets the detected encoding if applicable to the current document format. At the moment detects encoding only for HTML documents.

public Encoding Encoding { get; }

Examples

Shows how to detect encoding in an html file.

FileFormatInfo info = FileFormatUtil.DetectFileFormat(MyDir + "Document.html");

Assert.That(info.LoadFormat, Is.EqualTo(LoadFormat.Html));

// The Encoding property is used only when we create a FileFormatInfo object for an html document.
Assert.That(info.Encoding.EncodingName, Is.EqualTo("Western European (Windows)"));
Assert.That(info.Encoding.CodePage, Is.EqualTo(1252));

See Also