页面编码问题,ASP页面向ASP.NET页面传递中文信息,乱码到底怎么解决??
秋的红果实 2011-11-06 09:03:23 都弄2,3天了,还是没有解决,就卡在这里了。我的代码如下所示:
asp页面:
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>无标题页</title>
</head>
<body>
<%
dim uname
uname="汉字信息"
%>
<a href="http://127.0.0.1/commonceshi/1.aspx?p=<%=uname %>" target="_blank">click</a>
<br />其他静态信息
</body>
</html>
.NET cs文件
public partial class _1 : System.Web.UI.Page
{
static string username;
protected void Page_Load(object sender, EventArgs e)
{
username = Request["p"].ToString();
Response.Write(username);
}
}
根据一位网友的方法,我在.NET的config里已经加入了统一编码的代码:<globalization requestEncoding="GB2312" responseEncoding="GB2312" culture="zh-CN" fileEncoding="GB2312"/>,这样中文参数输出就不是乱码了,但前提是,asp页面编码必须是GB2312,此编码下,asp页面其他静态信息变成乱码了,最终还是不行
我把config里的GB2312都改成utf-8,asp页面也是utf-8,我以为都统一成utf-8了,但中文参数输出还是乱码
到底怎么解决乱码问题?