比如百度:http://www.baidu.com/s?wd=%E4%B8%93%E4%B8%9A
wd的值是什么编码?应该怎么解析?

解决方案 »

  1.   

    Url编码
    Server.UrlDecode
    或者HttpUtility.UrlDecode
      

  2.   

    解密,第一种是默认也就是UTF-8,第二种是GB2312
    return HttpUtility.UrlDecode(str).ToString();
    return HttpUtility.UrlDecode(str, Encoding.GetEncoding("GB2312")).ToString();
    加密
    return HttpUtility.UrlEncode(str).ToString();
    return HttpUtility.UrlEncode(str, Encoding.GetEncoding("GB2312")).ToString();
      

  3.   

    UrlEncode
    UrlDecode传参中文 符号其他 的时候要进行UrlEncode接收UrlDecode
      

  4.   

    引入System.Web的dll
    然后在程序中用System.Web.HttpUtility.UrlDecode(str)