asp.net中url字符串编码乱码的原因与解决方法
2013-08-14 00:00
681 查看
先看实例
这个时候alert出来的编码很正常,都是汉字。
但是在后台获取时已经乱码
web.config已经配置为UTF-8 但是还是不行
最终解决方案
function webChart() { var t = document.getElementById("txtReceive"); if (t.value == null || t.value == "") { alert("请先进行查询"); } else { alert(t.value); document.getElementById("center-iframe").src = "map/industryMap.aspx?_indeustry=" + t.value; }}
这个时候alert出来的编码很正常,都是汉字。
但是在后台获取时已经乱码
protected void Page_Load(object sender, EventArgs e) { Industry = Request.QueryString["_indeustry"].ToString(); InitMap(); getShowMuilt(); }
web.config已经配置为UTF-8 但是还是不行
<system.web> <globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" /> </system.web>
最终解决方案
function webChart() { var t = document.getElementById("txtReceive"); if (t.value == null || t.value == "") { alert("请先进行查询"); } else { var url = encodeURI("map/industryMap.aspx?_indeustry=" + t.value); alert(url); document.getElementById("center-iframe").src = url; } }
相关文章推荐
- asp.net中url字符串编码乱码的原因与解决方法
- 解决 Asp.net 中,url传参乱码 方法之一:(UrlDecode)
- asp.net 中文字符串提交乱码的解决方法
- Asp.Net Url 传值出现乱码的解决方法(包括js传值)
- Asp.Net Url 传值出现乱码的解决方法(包括js传值)
- 在ASP.NET里通过URL传递参数得到乱码的解决方法
- [转]asp.net URL中包含中文参数造成乱码的解决方法
- Asp.Net Url 传值出现乱码的解决方法
- asp.net URL 显示乱码 解决方法
- ASP.NET中URL传参数出现乱码解决方法
- asp.net URL 显示乱码 解决方法
- Asp.Net Url 传值出现乱码的解决方法
- asp.net 中文字符串提交乱码的解决方法
- ASP.NET中URL传参数出现乱码解决方法
- asp.net导出Excel乱码的原因及解决方法
- asp.net导出Excel乱码的原因及解决方法
- Asp.Net Url 传值出现乱码的解决方法
- asp.net URL中包含中文参数造成乱码的解决方法