Aspose::Words::FileFormatInfo::get_Encoding method

FileFormatInfo::get_Encoding method

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

System::SharedPtr<System::Text::Encoding> Aspose::Words::FileFormatInfo::get_Encoding() const

Examples

Shows how to detect encoding in an html file.

SharedPtr<FileFormatInfo> info = FileFormatUtil::DetectFileFormat(MyDir + u"Document.html");

ASSERT_EQ(LoadFormat::Html, info->get_LoadFormat());

// The Encoding property is used only when we create a FileFormatInfo object for an html document.
ASSERT_EQ(u"Windows-1252", info->get_Encoding()->get_WebName());
ASSERT_EQ(1252, info->get_Encoding()->get_CodePage());

See Also