难题:JS下调用xmlhttp返回中文乱码,有没有办法处理???

myt9527 2005-07-22 05:07:00
强调一下:是在js下,不是vbs,如果是vbs那我就知道怎么办了。
...全文
331 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
myt9527 2005-07-22
  • 打赏
  • 举报
回复
有没有办法在一个静态页面里面来完成呢
lyh4226 2005-07-22
  • 打赏
  • 举报
回复
学习啊.顶....
fatcat_xp 2005-07-22
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift-JIS">
<SCRIPT LANGUAGE="JavaScript">
<!--
function SelText(){
var oRangeRef = document.body.createTextRange();
alert(oRangeRef.text);
}
//-->
</SCRIPT>
<%
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
'Http.open "GET",url,false
Http.open "POST",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
'getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
getHTTPPage=bytesToBSTR(Http.responseBody,"Shift-JIS")
set http=nothing
if err.number<>0 then
err.Clear
end if
end function

Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing

End Function
%>

<title></title>
</head>

<body onload="SelText()">
<%
Dim Url,Html
Url="http://localhost/akira/default.asp"
Html = getHTTPPage(Url)
Response.write Html
%>
</body>
</html>
fatcat_xp 2005-07-22
  • 打赏
  • 举报
回复
学习……
myt9527 2005-07-22
  • 打赏
  • 举报
回复
没有效果啊,还是一样
wxylvmnn 2005-07-22
  • 打赏
  • 举报
回复
encoding="gb2312"不行就不知道啦

28,406

社区成员

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

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