Output RTF special characters to Unicode
Asked Answered
E

2

3

I have been looking around ocn Google and Stackoverflow but haven't found what I needed, but my question seems quite simple. Anyhow;

What is the way to convert a string of RTF special characters such as "\'d3\'d6" (In this case Russian) to unicode chars or string using C#?

Eichhorn answered 21/8, 2009 at 8:25 Comment(0)
D
6

any of the following should help:

Dak answered 22/8, 2009 at 13:34 Comment(0)
P
0

You can convert those characters:

int findUTF = -1;
bool continueUTFSearch = true;
do
{
  findUTF = HTMLText.IndexOf(@"\'", findUTF + 1);
  if (findUTF != -1)
  {
    string replacedString = HTMLText.Substring(findUTF, 4);
    string esacpeddString = replacedString.Substring(2);

    int esacpeddCharValue = Convert.ToInt16(esacpeddString, 16); 
    char esacpeddChar = Convert.ToChar(esacpeddCharValue);

    esacpeddString = esacpeddChar.ToString();

    HTMLText = HTMLText.Replace(replacedString, esacpeddString);
    findUTF = -1;
  }
  else
  {
    continueUTFSearch = false;
  }
}
Pelvic answered 1/1, 2013 at 0:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.