public void RecognizeUtf8Text(bool recognizeUtf8Text) { //ExStart //ExFor:RtfLoadOptions //ExFor:RtfLoadOptions.#ctor //ExFor:RtfLoadOptions.RecognizeUtf8Text //ExSummary: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()); //ExEnd }
public void RecognizeUtf8Text() { //ExStart:RecognizeUtf8Text RtfLoadOptions loadOptions = new RtfLoadOptions { RecognizeUtf8Text = true }; Document doc = new Document(MyDir + "UTF-8 characters.rtf", loadOptions); doc.Save(ArtifactsDir + "WorkingWithRtfLoadOptions.RecognizeUtf8Text.rtf"); //ExEnd:RecognizeUtf8Text }
public static void RecognizeUtf8Text(string dataDir) { //ExStart:RecognizeUtf8Text RtfLoadOptions loadOptions = new RtfLoadOptions(); loadOptions.RecognizeUtf8Text = true; Document doc = new Document(dataDir + "Utf8Text.rtf", loadOptions); dataDir = dataDir + "RecognizeUtf8Text_out.rtf"; doc.Save(dataDir); //ExEnd:RecognizeUtf8Text Console.WriteLine("\nUTF8 text has recognized successfully.\nFile saved at " + dataDir); }
public void RecognizeUtf8Text() { //ExStart //ExFor:RtfLoadOptions.RecognizeUtf8Text //ExSummary:Shows how to detect UTF8 characters during import. RtfLoadOptions loadOptions = new RtfLoadOptions { RecognizeUtf8Text = true }; Document doc = new Document(MyDir + "RtfLoadOptions.RecognizeUtf8Text.rtf", loadOptions); doc.Save(ArtifactsDir + "RtfLoadOptions.RecognizeUtf8Text.rtf"); //ExEnd }
public void RecognizeUtf8Text(bool doRecognizeUtb8Text) { //ExStart //ExFor:RtfLoadOptions //ExFor:RtfLoadOptions.#ctor //ExFor:RtfLoadOptions.RecognizeUtf8Text //ExSummary:Shows how to detect UTF8 characters during import. RtfLoadOptions loadOptions = new RtfLoadOptions { RecognizeUtf8Text = doRecognizeUtb8Text }; Document doc = new Document(MyDir + "UTF-8 characters.rtf", loadOptions); Assert.AreEqual( doRecognizeUtb8Text ? "“John Doe´s list of currency symbols”™\r€, ¢, £, ¥, ¤" : "“John Doe´s list of currency symbolsâ€\u009dâ„¢\r€, ¢, £, Â¥, ¤", doc.FirstSection.Body.GetText().Trim()); //ExEnd }