Aspose::Words::Loading::RtfLoadOptions::get_RecognizeUtf8Text method

RtfLoadOptions::get_RecognizeUtf8Text method

When set to true, CharsetDetector will try to detect UTF8 characters, they will be preserved during import. Default value is false.

bool Aspose::Words::Loading::RtfLoadOptions::get_RecognizeUtf8Text() const

Examples

Shows how to detect UTF-8 characters while loading an RTF document.

// Create an "RtfLoadOptions" object to modify how we load an RTF document.
auto loadOptions = MakeObject<RtfLoadOptions>();

// Set the "RecognizeUtf8Text" property to "false" to assume that the document uses the ISO 8859-1 charset
// and loads every character in the document.
// Set the "RecognizeUtf8Text" property to "true" to parse any variable-length characters that may occur in the text.
loadOptions->set_RecognizeUtf8Text(recognizeUtf8Text);

auto doc = MakeObject<Document>(MyDir + u"UTF-8 characters.rtf", loadOptions);

ASSERT_EQ(recognizeUtf8Text ? String(u"“John Doe´s list of currency symbols”™\r") + u"€, ¢, £, ¥, ¤"
                            : String(u"“John Doe´s list of currency symbolsâ€\u009dâ„¢\r") + u"€, ¢, £, Â¥, ¤",
          doc->get_FirstSection()->get_Body()->GetText().Trim());

See Also