C# 读取网页出现意大急求解码!!!在线等!! 意大利甲組聯賽特别投注 怎么转码, 这些数据都是我从网上读取出来的。!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Text.RegularExpressions;namespace WindowsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static string UnicodeToGB(string content) { Regex objRegex = new Regex("&#(?<UnicodeCode>[\\d]{5});", RegexOptions.IgnoreCase); Match objMatch = objRegex.Match(content); if (objMatch.Success) { StringBuilder sb = new StringBuilder(content); while (objMatch.Success) { string code = Convert.ToString(Convert.ToInt32(objMatch.Result("${UnicodeCode}")), 16); byte[] array = new byte[2]; array[0] = (byte)Convert.ToInt32(code.Substring(2), 16); array[1] = (byte)Convert.ToInt32(code.Substring(0, 2), 16); sb.Replace(objMatch.Value, Encoding.Unicode.GetString(array)); objMatch = objMatch.NextMatch(); } return sb.ToString(); } else { return content; } } private void button1_Click(object sender, EventArgs e) { MessageBox.Show(UnicodeToGB("意大利甲組聯賽特别投注")); } }} 添加web引用System.Web.HttpUtility.UrlDecode("") 实在太感谢了。 谢谢!!添加web引用System.Web.HttpUtility.UrlDecode("") 这个没有用。。 我试过了。 C# 内存Form截图问题 这段js,不知道什么原因,程序不往下执行了 如何把网站项目中的***.aspx.cs文件编译成dll到bin文件夹 ExecuteReader() 方法有办法一次读数据库中的所有列 两个使用VS.net问题 设置菜单调整主窗口透明度 关于1个从视图中获取记录 并保存入 某表的SQL语句问题,在线等 谢谢 有谁能告诉我在那里可以下载用于C#的第三方控件,在此先谢了。 关于C#中字符的判断问题!(急) 检测电脑是否有framework4.5环境的源码 把二进制数据流还原成图片问题 正则表达式空格回车问题
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public static string UnicodeToGB(string content)
{
Regex objRegex = new Regex("&#(?<UnicodeCode>[\\d]{5});", RegexOptions.IgnoreCase);
Match objMatch = objRegex.Match(content);
if (objMatch.Success)
{
StringBuilder sb = new StringBuilder(content);
while (objMatch.Success)
{
string code = Convert.ToString(Convert.ToInt32(objMatch.Result("${UnicodeCode}")), 16);
byte[] array = new byte[2];
array[0] = (byte)Convert.ToInt32(code.Substring(2), 16);
array[1] = (byte)Convert.ToInt32(code.Substring(0, 2), 16); sb.Replace(objMatch.Value, Encoding.Unicode.GetString(array)); objMatch = objMatch.NextMatch();
}
return sb.ToString();
}
else
{
return content;
}
} private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(UnicodeToGB("意大利甲組聯賽特别投注"));
}
}
}
System.Web.HttpUtility.UrlDecode("")
实在太感谢了。 谢谢!!添加web引用
System.Web.HttpUtility.UrlDecode("") 这个没有用。。 我试过了。