当前位置: 代码迷 >> ASP.NET >> asp.net页面跳转至html参数为何显示乱码?该怎么解决
  详细解决方案

asp.net页面跳转至html参数为何显示乱码?该怎么解决

热度:3146   发布时间:2013-02-25 00:00:00.0
asp.net页面跳转至html参数为何显示乱码???
web.config   设置为:
        <globalization
                        requestEncoding= "GB2312 "
                        responseEncoding= "GB2312 "
      />
Response.Redirect( "htm?t=中国人 ");

htm?t=%d6%d0%b9%fa%c8%cb
显示均为乱码
htm代码:
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head>
        <meta   content= "text/html;   charset=gb2312 "   http-equiv= "content-type "   />
        <title> 无标题页 </title>
</head>
<body>
<script   language= "javascript "   type= "text/javascript ">
        var   str=window.location.href;  
        var   es=/t=/;  
        es.exec(str);  
        var   Info=RegExp.rightContext;  
        Info   =   unescape(Info);
        document.writeln(Info);  
</script>
</body>
</html>


------解决方案--------------------------------------------------------
好像是有问题,先用下面这个,吃完饭再看看 Response.Write( " <script> window.location.href= 'show.htm?t=中文 '; </script> "); Response.End();
------解决方案--------------------------------------------------------
刚写错了,一下代码经过测试,可以运行

Response.Write( " <script language= 'javascript '> window.location= 'htm.htm?t= '+escape( '中国人 '); </script> ");
  相关解决方案