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

类别:.NET开发 点击:0 评论:0 推荐:

例子如下:当抓取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
%>

本文地址:http://com.8s8s.com/it/it43861.htm