2009-08-21 179 views
3

我一直在看ocn谷歌和Stackoverflow,但还没有找到我需要的东西,但我的问题似乎很简单。无论如何;输出RTF特殊字符为Unicode

什么是转换一串RTF特殊字符,如“\'d3 \'d6”(在这种情况下,俄语)到Unicode字符或字符串使用C#?

回答

0

您可以将这些字符:

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; 
    } 
}