不能显示中文

bbzy 2008-09-23 05:04:42
我的语句如下

<%
response.Redirect "js/xsjnewslx.asp"
%>

这个xsjnewslx.asp实际上是个表格显示语句
奇怪的不能显示其中的中文?
请问是怎么回事?

...全文
323 30 打赏 收藏 转发到动态 举报
写回复
用AI写文章
30 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
会不会是你字的颜色和背景色一样了看不到而已啊?
  • 打赏
  • 举报
回复
我真的不知道你那边是怎么个状况
我测试了都一点问题没有
bbzy 2008-09-24
  • 打赏
  • 举报
回复
littlelam 的方法,还是不行
littlelam 2008-09-24
  • 打赏
  • 举报
回复
主页面用

Session.CodePage = 936
Response.Charset = "GB2312"

要抓取的页面用

Session.CodePage = 65001
Response.Charset = "utf-8"

这样的编码不用转换


注意“要抓取的页面”文件编码也要以utf-8格式
bbzy 2008-09-24
  • 打赏
  • 举报
回复
主程序如下

<style>#button {
width: 764px;
border-right: 0px solid #000;
padding: 0 0 0em 0;
margin-bottom: 0.2em; <!-- 控制行间距离 -->
font-size: 90%;
background-color: #FCFCFE;
color: #333;
}

#button ul {
list-style: none;
margin: 0;
padding: 0;
border: none;
}

#button li {
border-bottom: 1px solid #FCFCFE;
width:109px; <!-- 控制文字宽度 -->

margin: 0;
}

#button li a {
display: block;
padding: 2px 2px 2px 0.2em; <!-- 控制文字高度 -->
border-left: 0px solid #1958b7;
border-right: 0px solid #508fc4;
border-bottom: 1px solid #508fc4;

background-color: #E0E3F6;
color: #0099ff;
text-decoration: none;
width: 100%;
}

html>body #button li a {
width: auto;
}

#button li a:hover {
border-left: 1px solid #1c64d1;
border-right: 1px solid #5ba3e0;
border-bottom: 0px solid #508fc4;
background-color: #FFFFFF;
color: #0099ff;
font-weight: bold;
}

marquee
{
border:1px black solid;
display:none;
background-color:#7788FF;
}

</style>
<script type="text/javascript">
<!--
var xmlhttp;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
function getName(lx)
{
xmlhttp.open("post","xmlhttp.asp?lx="+lx);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState==4){

document.getElementById("newziy").innerHTML =xmlhttp.responseText;
}
}
xmlhttp.setRequestHeader("If-Modified-Since","0");
xmlhttp.send(null);
}

//-->
</script>
<%
Dim oyear,omonth,nyear,nmonth,oday,nday,date1,xdate1,date2,xdate2
oyear=2004
omonth=1
nyear=year(now())
nmonth=month(now())
oday=1
nday=setDay(nyear,nmonth)

date1 = cstr(oyear) & "-" & cstr(omonth) & "-" & cstr(oday)
xdate1 =cdate(date1)
date2 = cstr(nYear) & "-" & cstr(nMonth) & "-" & cstr(nday)
'response.write "*"&date1&"*"&date2
xdate2 =cdate(date2)

function wordlen(strChinese)
dim lenTotal,strWord,i
lenTotal = 0
for i=1 to Len(strChinese)
strWord = mid(strChinese, i, 1)
if asc(strWord) < 0 or asc(strWord) > 127 then
lenTotal = lenTotal + 2
else
lenTotal = lenTotal + 1
end if
next
wordlen=lenTotal
end function
Dim flag,maxlen

%>
<!-- 把下列代码加入到body区内 -->
<div id="button">
<ul style="list-style:none;">
<li style="float:left" onmouseover="javascript:getName(7)"><a href="xsjlist.asp?BName=县市局动态&odate="&xdate1&"&ndate="&xdate2&"&sort=2><b>县市局动态</b></a></li>
<li style="float:left" onmouseover="javascript:getName(6)" ><a href="xsjlist2.asp?BName=城市A&SName=城市A&odate=<%=xdate1%>&ndate=<%=xdate2%>"><b>城市A</b></a></li>
<li style="float:left" onmouseover="javascript:getName(5)" ><a href="xsjlist2.asp?BName=开发区&SName=开发区&odate=<%=xdate1%>&ndate=<%=xdate2%>"><b>开发区</b></a></li>
<li style="float:left" onmouseover="javascript:getName(4)" ><a href="xsjlist2.asp?BName=城市B&SName=城市B&odate=<%=xdate1%>&ndate=<%=xdate2%>"><b>城市B<b></a></li>
<li style="float:left" onmouseover="javascript:getName(3)"><a href="xsjlist2.asp?BName=城市c&SName=城市c&odate=<%=xdate1%>&ndate=<%=xdate2%>"><b>城市c<b></a></li>
<li style="float:left" onmouseover="javascript:getName(2)"><a href="xsjlist2.asp?BName=城市d&SName=城市d&odate=<%=xdate1%>&ndate=<%=xdate2%>"><b>城市d<b></a></li>
<li style="float:left" onmouseover="javascript:getName(1)"><a href="xsjlist2.asp?BName=城市E&SName=城市E&odate=<%=xdate1%>&ndate=<%=xdate2%>"><b>城市E<b></a></li>
</ul>
</div>

<div id="newziy" style="text-align:center;text-valign:top;margin:0;">
<!-- #include file = "js/xsjnews0.asp"-->
</div>

xmlhttp.asp程序
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--#include file="conn2.asp" -->
<!--#include file="user/user_config.asp"-->
<!--#include file="test.asp" -->
<%

lx=Request("lx")
if lx="" or not isnumeric(lx) then
response.Write("参数错误")
response.End()
end if
select case lx
case 6
showlx()
end select
%>
  • 打赏
  • 举报
回复
。。。没有理由
我实验了多次都可以
bbzy 2008-09-24
  • 打赏
  • 举报
回复
谢谢chinmo

按照您的方法试验了,还是一样的,不能显示中文
七胖儿 2008-09-24
  • 打赏
  • 举报
回复
恩,楼上说的有道理
估计肯定是你编码的问题了,你用的什么编辑器编辑的asp文件
看看是什么编码
  • 打赏
  • 举报
回复
我只想问一句,你为什么要这么做?
为什么要转向
为什么不这样放在一个功用文件里,比如test.asp:
<%function show()%>
<table width="970" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>中国 </td>
<td>人民 </td>
</tr>
<tr>
<td>3333 </td>
<td>777 </td>
</tr>
<tr>
<td>444 </td>
<td>888 </td>
</tr>
<tr>
<td>555 </td>
<td>999 </td>
</tr>
</table>
<%end function%>

然后这个

xmlhttp.asp
<!--#include file="conn2.asp" -->
<!--#include file="function_title.asp" -->
<!--#include file="test.asp" -->
<%Response.charset="GB2312"


lx=Request("lx")
if lx="" or not isnumeric(lx) then
response.Write("参数错误")
response.End()
end if
select case lx
case 2
show()
case 3
show1()
case 4
show2()
case 5
show3()
end select
%>
类似这样的

何必那样自找苦死
bbzy 2008-09-24
  • 打赏
  • 举报
回复
help me!
灵易联盟 2008-09-24
  • 打赏
  • 举报
回复
汗,感觉,条理好乱~~

1、<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
这句也加到主程序的开头~~

2、麻烦在xmlhttp.asp文件上作个分隔,搞得我以为是同一个文件咯~~
jackyBody 2008-09-24
  • 打赏
  • 举报
回复
<%Response.charset="字符集" 不行嘛??
13617650029 2008-09-24
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 13617650029 的回复:]
检查下你自己的IE吧~是不是设置成utf-8了??!!
[/Quote]

早就跟你说了啊,你看看是不是你浏览器设置了别的编码?

ie -- 查看 -- 编码 -- 选择别的一下看看正常不
bbzy 2008-09-24
  • 打赏
  • 举报
回复
阿拉伯数字可以显示
3monk 2008-09-24
  • 打赏
  • 举报
回复
使用记事本打开,然后另存为ansi编码。或是utf-8码。都试试。
  • 打赏
  • 举报
回复
是在不行就输出xml,然后解析一下
wangxiaoning868 2008-09-24
  • 打赏
  • 举报
回复
用escape()函数和unescape()函数进行传送数据的编码和解码,试试看
bbzy 2008-09-23
  • 打赏
  • 举报
回复
在<li style="float:left" onmouseover="javascript:getName(1)"> <a href="xsjlist.asp?BName=县市局动态&odate="&xdate1&"&ndate="&xdate2&"&sort=2> <b>县市局动态 </b> </a> </li>
后面还有一条语句
<script language="javascript" src="js/xsjnews0.js"> </script>
是可以显示xsjnews0.js中的中文的

谢谢rankisky ,可我的是文件啊
rankisky 2008-09-23
  • 打赏
  • 举报
回复
'字符转换

Function bytes2BSTR(arrBytes)
strReturn = ""
arrBytes = CStr(arrBytes)
For i = 1 To LenB(arrBytes)
ThisCharCode = AscB(MidB(arrBytes, i, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(arrBytes, i+1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
13617650029 2008-09-23
  • 打赏
  • 举报
回复
检查下你自己的IE吧~是不是设置成utf-8了??!!
加载更多回复(10)

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧