unicode字符串如何解码? 一大串字符串中,存在 '比利亚雷亚尔','佩度兰奴'这样的unicode,中文中夹着少量unicode代码。怎么把这些unicode解码成中文??用C# 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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()); }乱写的 自己看把. 佩请问这是十进制???将20329转换成十六进制代码为4F69this.textBox1.Text = '\u4F69'.ToString();如此类推 可以将Unicode的汉字打印出来如果是Ascii码 改成'\x ' char _ValueChar = (char)int.Parse(_Text); 原来这样就可以转过来太感谢了~! winform界面间传值问题 C#如何调用activeX控件的对象和方法,但无需注册它? vs2005简单的问题 linq的奇怪问题 再问gridview的问题 求救:将图片通过过程存入oracle vb调用webservice时,中文参数成乱码如何解决,急!!! 请问用C#编写的软件都有哪些,这门语言前景怎么样? c#初学者,哪位有电子版的书给两本 C#, 将程序放到电脑的启动文件夹下,当电脑启动后,为什么会出现创建窗体句柄时出错? C# XM文件怎么序列化啊?急………… 无法找到表 0
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()); }乱写的 自己看把.
将20329转换成十六进制代码为4F69
this.textBox1.Text = '\u4F69'.ToString();如此类推 可以将Unicode的汉字打印出来
如果是Ascii码 改成'\x '
原来这样就可以转过来
太感谢了~!