3

私は ocn Google と Stackoverflow を見回してきましたが、必要なものが見つかりませんでしたが、私の質問は非常に単純に思えます。とにかく;

"\'d3\'d6" (この場合はロシア語) などの RTF 特殊文字の文字列を C# を使用して Unicode 文字または文字列に変換する方法は何ですか?

4

2 に答える 2

6

次のいずれかが役立ちます。

于 2009-08-22T13:34:18.553 に答える
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;
  }
}
于 2013-01-01T00:32:27.863 に答える