ASP页面内出现中文乱码问题?
来源:百度知道 编辑:UC知道 时间:2024/06/29 21:06:49
原先中文能正常显示的,现在变成乱码了,不知有何解决的方法
<meta http-equiv="content-type" charset=gb2312">'/////现在加了这句也不行
<!--#include file="fuction.asp"-->
<%
sub dindan()
if request.cookies("snsn")("username")="" then
response.Redirect "user.asp"
response.End
end if
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="55%"> ?ò μ? ?? μ¥</td>
<td width="49%">
<div align="right">
<select name="zhuangtai" class="wenbenkuang" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} e
<meta http-equiv="content-type" charset=gb2312">'/////现在加了这句也不行
<!--#include file="fuction.asp"-->
<%
sub dindan()
if request.cookies("snsn")("username")="" then
response.Redirect "user.asp"
response.End
end if
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="55%"> ?ò μ? ?? μ¥</td>
<td width="49%">
<div align="right">
<select name="zhuangtai" class="wenbenkuang" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} e
首先以UTF-8编码为例,在页面顶部加代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Response.Charset="utf-8"%>
这句必须放在最顶部,作为代码第一句,同时还要设置网页编码为UTF-8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
同样的道理,如果是GB2312的编码,就要写成:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Response.Charset="gb2312"%>
同时把网页编码改成gb2312就可以了。
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
最后一点说明,有时候你看到显示正常的,但别人看到就是乱码。原因就可能是因为使用的操作系统语言版本不一样。例如一般用简体中文操作系统,设置GB2312编码自己看就是正常的,但是用在国外服务器运行的话就会出现乱码了,因为国外一般用英文操作系统了。只有在页面完整引入上面的几句代码,不管是什么系统都会显示正常了。
修改→文本属性→标题/编码→编码 选择简体中文(GB2312)
你是不是添加内容时,填写的是空值,告诉你个办法,把你提交到数据库中的内容删除,然后添加就可以了,注意不要内容为空就添加.
用 editplus 等有带编码转换的编辑器,转换下文件的编码。。
或者新建一个asp 文件,代码考过去。。
是在不行就加上。。
response.charset=&qu