一大串字符串中,存在  '比利亚雷亚尔','佩度兰奴'这样的unicode,中文中夹着少量unicode代码。怎么把这些unicode解码成中文??用C#

解决方案 »

  1.   

     string _Value = "'比利亚雷亚尔','佩度兰奴' ";
                System.Text.RegularExpressions.Regex _Regex = new System.Text.RegularExpressions.Regex("&#.*?;");
                System.Text.RegularExpressions.MatchCollection _Collection=  _Regex.Matches(_Value);            foreach (System.Text.RegularExpressions.Match _Match in _Collection)
                {
                    string _Utext = _Match.Value;                string _Text = _Utext.Substring(2, _Utext.Length - 3);
                    char _ValueChar = (char)int.Parse(_Text);
                    _Value = _Value.Replace(_Utext, _ValueChar.ToString());            }乱写的 自己看把.
      

  2.   

    &#20329请问这是十进制???
    将20329转换成十六进制代码为4F69
    this.textBox1.Text = '\u4F69'.ToString();如此类推  可以将Unicode的汉字打印出来
    如果是Ascii码 改成'\x  ' 
      

  3.   

    char _ValueChar = (char)int.Parse(_Text); 
    原来这样就可以转过来
    太感谢了~!