ASP.NET中URL传参数出现乱码解决方法
作者: 佚名, 出处:IT专家网社区, 责任编辑: 包春林,
2008-07-23 04:00
在test.aspx中,只要获取title参数的值并显示出来即可,本来用Request["title"]就可解决的问题却因链接所处页面的编码不同而变得复杂起来
在test.aspx中,只要获取title参数的值并显示出来即可,本来用Request["title"]就可解决的问题却因链接所处页面的编码不同而变得复杂起来:
当链接所处的页面是用GB2312编码时,如果test.aspx也是GB2312则获取的参数值不乱码,否则乱码;
当链接所处的页面是用UTF-8编码时,如果test.aspx也是UTF-8则获取的参数值不乱码,否则乱码;
gb.htm:
| < html>
< head> < meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> < title>gb2312测试页< /title> < /head> < body> < a href="#" onclick="window.open('http://www.aaa.com');">Links< /a> < /body> < /html> utf8.htm: < html> < head> < meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> < title>utf-8测试页< /title> < /head> < body> < a href="#" onclick="window.open('http://www.aaa.com');">Links< /a> < /body> < /html> |
- 本文关键词:

