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#?

Karl Johan
  • 4,012
  • 1
  • 25
  • 36

2 Answers2

6

any of the following should help:

Community
  • 1
  • 1
ax.
  • 58,560
  • 8
  • 81
  • 72
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;
  }
}