unicode字符串如何解码?

雷问X 2009-11-10 10:42:16
一大串字符串中,存在

'比利亚雷亚尔','佩度兰奴'

这样的unicode,中文中夹着少量unicode代码。怎么把这些unicode解码成中文??用C#
...全文
166 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
雷问X 2009-11-10
  • 打赏
  • 举报
回复
char _ValueChar = (char)int.Parse(_Text);
原来这样就可以转过来
太感谢了~!
快乐乔巴 2009-11-10
  • 打赏
  • 举报
回复
佩请问这是十进制???
将20329转换成十六进制代码为4F69
this.textBox1.Text = '\u4F69'.ToString();

如此类推 可以将Unicode的汉字打印出来
如果是Ascii码 改成'\x '
zgke 2009-11-10
  • 打赏
  • 举报
回复
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());

}

乱写的 自己看把.

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧