由统计系统获得的URL地址:str1 = System.Web.HttpUtility.UrlDecode(Url1, System.Text.Encoding.GetEncoding(936));
str2 = System.Web.HttpUtility.UrlDecode(Url1, System.Text.Encoding.UTF8);以上转换方法都是乱码,还有什么好方法吗???http://127.0.0.1/class.aspx?ClassSec=%E9%96%BA%E5%AC%AB%EE%9A%86%E5%A8%BC%E5%A0%A5%E5%B4%9A%E7%92%BA%E5%93%84%EE%86%8A%E9%96%BA%E2%82%AC%E8%A4%B0%E6%8E%93%E4%BA%A4&ClassThi=%E5%A6%AB%E6%9D%BF%E6%A3%97%E9%A1%95%E8%BE%A9%E6%8B%8B%E9%91%BC%E5%89%81%E6%A8%88

解决方案 »

  1.   

    直接在程序里面request如果编码有问题,就在web.config设置下<globalization requestEncoding="gb2312" responseEncoding="gb2312" />页面也设置下<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      

  2.   

    Server.UrlDecode(Request.QueryString["wd"])
      

  3.   

    Server.UrlDecode(Request.QueryString["wd"])
    Request.QueryString["wd"]是你传过来的参数
    比如,www.text.com?wd=参数
      

  4.   

    Server.UrlDecode(Request.QueryString["text"])
    这个方法怎么不对呢,我都测试过了
    你自己试下,新建2个aspx页,Default1和Default2
    Default1里面的Page_Load里写
    Response.Redirect("Default5.aspx?text=阿");
    Default2里面的Page_Load里写
    string text = Server.UrlDecode(Request.QueryString["text"]);
    this.Text = text;
    自己试下,我是可以显示中文的。~~
      

  5.   

    你的符号翻译:
     閺嬫娼堥崚璺哄閺€褰掓交&ClassThi=妫板棗顕辩拋鑼剁樈 HttpUtility.UrlDecode
      

  6.   

    URLEncode是这样编码的:
    1。数字和字母不变。
    2。空格变为"+"号。
    3。其他被编码成"%"加上他们的ascii的十六进制,规律是这样的 
    比如“啊”字 Ascii的十六进制是B0A1——>%B0%A1(Note:它是每个字节前加个%)。 StringWriter writer = new StringWriter();
    Server.UrlDecode(Encodestring, writer);
    Label.Text = writer.ToString();
      

  7.   

    没搞定,有可能加密过了。比如gzip加密后差不多是这样的。
      

  8.   


    不应该加密吧。我只是用Request.Url.PathAndQuery 获得当前URL地址而已。其他的什么也没有做。
      

  9.   


    <html>
    <head>
    <script type="text/javascript">
    function DeCode()
    {
      var urlstring ="http://127.0.0.1/class.aspx?ClassSec=%E9%96%BA%E5%AC%AB%EE%9A%86%E5%A8%BC%E5%A0%A5%E5%B4%9A%E7%92%BA%E5%93%84%EE%86%8A%E9%96%BA%E2%82%AC%E8%A4%B0%E6%8E%93%E4%BA%A4&ClassThi=%E5%A6%AB%E6%9D%BF%E6%A3%97%E9%A1%95%E8%BE%A9%E6%8B%8B%E9%91%BC%E5%89%81%E6%A8%88";
      alert(decodeURI(urlstring));
    }
    function Encode()
    {
    var url ="http://127.0.0.1/class.aspx?ClassSec=一个好人";
    alert(encodeURI(url));
    }
    </script></head>
    <body>
    <input type="button" id="button1" onclick="DeCode()" value="DeCode"/>
    <input type="button" id="button2" onclick="Encode()" value="Encode"/>
    </body></html>你给的是中文吗?
      

  10.   

    你这样试试
    设置web.config文件。
    <system.web> 
    <globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" /> 
    </system.web> 你传递中文之前,将要传递的中文参数进行编码
    string Name = "中文参数"; 
    Response.Redirect("class.aspx?Name="+Server.UrlEncode(Name)); 
    然后在接收时再进行解码。 
    string Name = Request.QueryString["Name"]; 
    Response.Write(Server.UrlDecode(Name)); 
      

  11.   

    %e7%ae%87%e6%81%8f%e4%bb%8c转换后 箇恏仌
    是不是LZ在传递过来前就是这种字体啊?
      

  12.   

    你都不知道用什么方式编码出来的,怎么解?要么你很确定那是UTF-8,但如果不是UTF-8,你最好先从源代码或者别的地方确定编码方式,而不是靠尝试。
      

  13.   

    http://127.0.0.1/class.aspx?ClassSec=%E9%96%BA%E5%AC%AB%EE%9A%86%E5%A8%BC%E5%A0%A5%E5%B4%9A%E7%92%BA%E5%93%84%EE%86%8A%E9%96%BA%E2%82%AC%E8%A4%B0%E6%8E%93%E4%BA%A4&ClassThi=%E5%A6%AB%E6%9D%BF%E6%A3%97%E9%A1%95%E8%BE%A9%E6%8B%8B%E9%91%BC%E5%89%81%E6%A8%88================
    你这里有两个参数啊。
    还有,你确定这些中文不是你说的那种乱码,我的意思是,从ie中传过去的就是:
    闁哄 顨嗗鍫ュ礆镨哄搫颜婇柡钪 ぐ鎺扑氦? 濡 澘妫楅 杈╂媪阏煎墎妯? 
    =========================
    实在不行,你就一个字符字符的去解码。
    请你也给个真实的url。
    真实的url典范:1:http://www.dfa.com/class.aspx?dd=的似的发生
    在ie的地址栏会显示成:2:http://www.dfa.com/class.aspx?dd=%AC%AB%EE%9A
    我一般称呼1中的地址为真实的url,而2中的地址为ie地址栏的地址。
      

  14.   

    我还是个菜鸟,我不大明白你的意思,有兴趣这样试一下:
    str1 = System.Web.HttpUtility.UrlDecode(Url1, System.Text.Encoding.GetEncoding(936));
    str2 = System.Web.HttpUtility.UrlDecode(Url1, System.Text.Encoding.UTF8);
    下面是在JSP中的转换,在这里就不懂拉,参考下:
    str1 = new String(str1.getBytes("iso-8859-1"),"gbk");
    str2 = new String(str2.getBytes("iso-8859-1"),"gbk");
      

  15.   

    最简单办法,告诉你,把编码粘贴到baidu的搜索url后面,就看到了