C#中ASCLL转中文的问题

来源:百度知道 编辑:UC知道 时间:2024/06/12 11:14:00
请问如何把%e6%98%af%e5%af%b9%e5%85%ac%e5%8f%b8%e5%a4%a7%e6%b3%95%e5%ae%98%e5%9c%b0%e6%96%b9转换成中文
转换后的值应该是“是否噶虽然各方人士的”
我不太懂编码问题,听说这是16进制的ASCLL码,百分号在转换过程中应该是无意义的。请高手直接给出C#代码,多谢多谢!

引用System.Web.Dll
HttpUtility.UrlDecode("%e6%98%af%e5%af%b9%e5%85%ac%e5%8f%b8%e5%a4%a7%
e6%b3%95%e5%ae%98%e5%9c%b0%e6%96%b9",Encoding.UTF8 )

确实,专家都给你回答了,我再说点补充的嘛
方法一
http://blog.csdn.net/qiujiahao/archive/2007/08/09/1733169.aspx
在unicode 字符串中,中文的范围是在4E00..9FFF:CJK Unified Ideographs。

通过对字符的unicode编码进行判断来确定字符是否为中文。

protected bool IsChineseLetter(string input,int index)
...{
int code = 0;
int chfrom = Convert.ToInt32("4e00", 16); //范围(0x4e00~0x9fff)转换成int(chfrom~chend)
int chend = Convert.ToInt32("9fff", 16);
if (input != "")
...{
code = Char.ConvertToUtf32(input, index); //获得字符串input中指定索引index处字符unicode编码

if (code >= chfrom && code <= chen