Asp.net页面乱码的解决办法
Asp.net页面乱码第一种解决方案:
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
/>
requestEncoding="gb2312"
responseEncoding="gb2312"
/>
Asp.net页面乱码第二种解决方案:
<META http-equiv="content-type" content="text/html; charset=gb2312">
Asp.net页面乱码第三种解决方案:
下载文件时指定文件名,中文的文件名出现了乱码?
Response.AddHeader("Content-Disposition", "attachment; filename="+HttpUtility.UrlEncoding(filename.ToString ()));
Asp.net页面乱码第四种解决方案:
为什么文件读出来的中文字符是乱码? System.IO.StreamReader m_fs = System.IO.File.OpenText(Hfile_SelectFile.Value);
改为
System.IO.StreamReader m_fs = new System.IO.StreamReader(Hfile_SelectFile.Value,System.Text.Encoding.GetEncoding("gb2312"));
Asp.net页面乱码第五种解决方案:
解决查询字符串中文乱码问题?
查询内容用Server.UrlEncode编码
string url ="http://localhost/test/test.aspx?a="+ Server.UrlEncode("张三");
解
-->Server.UrlDecode()