RecognizeUtf8Text

RtfLoadOptions.RecognizeUtf8Text property

When set to true, will try to detect UTF8 characters, they will be preserved during import.

public bool RecognizeUtf8Text { get; set; }

Remarks

Default value is false.

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.
RtfLoadOptions loadOptions = new 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.RecognizeUtf8Text = recognizeUtf8Text;

Document doc = new Document(MyDir + "UTF-8 characters.rtf", loadOptions);

Assert.AreEqual(
    recognizeUtf8Text
        ? "“John Doe´s list of currency symbols”™\r" +
          "€, ¢, £, ¥, ¤"
        : "“John Doe´s list of currency symbolsâ€\u009dâ„¢\r" +
          "€, ¢, £, ¥, ¤",
    doc.FirstSection.Body.GetText().Trim());

See Also