抓取的网页汉字怎么全部是问号(???)

edisonli 2005-06-04 07:24:04
我试了其他网站都没问题,不知道是不是这个网站的问题。请高手帮忙!
代码如下
<%
wstr=getHTTPPage("http://www.travelsky.com/gb/content.jsp?cid=61001")
response.write wstr
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End function

Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
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
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function
%>
...全文
516 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
edisonli 2005-06-05
  • 打赏
  • 举报
回复
wtogether(wtogether)
真是太感谢了!!!!!!
阿门 2005-06-05
  • 打赏
  • 举报
回复
OK
wtogether 2005-06-05
  • 打赏
  • 举报
回复
这就是Netscape-Enterprise/3.6服务器弱的地方,如果你在请求的时候不说明你支持中文,它就不给你转换
加上这个声明就可以了
xmlhttp.setRequestHeader "Accept-Language", "zh-cn"
edisonli 2005-06-04
  • 打赏
  • 举报
回复
而且我用big5,GBK都试过了都不行
edisonli 2005-06-04
  • 打赏
  • 举报
回复
能帮我解决一下吗!
lovebanyi 2005-06-04
  • 打赏
  • 举报
回复
这个肯定是编码问题啊。
iamgsyy 2005-06-04
  • 打赏
  • 举报
回复
看了一下你的程序好象没问题!
现在你就看看你要抓的网页http://www.travelsky.com/gb/content.jsp?cid=61001用的是什么编码了!
估计不是GB2312
因为你用GB2312出来是乱码]

28,406

社区成员

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

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