编程语言

img cqhand

xml抓取繁体乱码正常显示的代码

发表于2004/9/30 12:07:00  1144人阅读

例子如下:当抓取xml文件的时候也有效:
.Charset = "utf-8"
.Position = 2
用来从第二个字节开始抓取。。
<%
on error resume next
                
Const adTypeBinary = 1
Const adTypeText = 2
Function Bytes2bStr(vin)
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
With BytesStream
.Type = adTypeText
.Open
.WriteText vin

.Position = 0
.Charset = "utf-8"
.Position = 2
StringReturn = .ReadText
.close
End With
Set BytesStream = Nothing

Bytes2bStr = StringReturn

End Function


id=request("id")
url="http://odds.190bp.com/history_3star.aspx?ID="&id

set oSend=createobject("Microsoft.XMLHTTP")
SourceCode = oSend.open ("GET",url,false)
oSend.send()


mj_code = bytes2BSTR(oSend.responseBody)
 
 if err.number=0 then

 start=Instr(mj_code,"<HTML>")
 over=Instr(mj_code,"</table></FONT></td>")
 mj_top=mid(mj_code,start,over-start)
 mj_top=replace(mj_top,"/png/","http://odds.190bp.com//png/")
 mj_top=replace(mj_top,"<img border=""0"" src=""images/client/betjoy46860.gif"">","")
 response.write mj_top
 response.write "</table></td></tr></table></body></html>"
  else
  wscript.echo err.description
 end if
%>

阅读全文
0 0

相关文章推荐

img
取 消
img