|
小偷经典教程之解决XML读取UTF-8 乱码
来源:
互联网
日期:2008-7-25
response.write xmlHttp("http://www.google.cn/", "utf-8")
Function xmlHttp(sUrl, sCharSet) On Error Resume Next Dim xml: set xml = Server.CreateObject("Microsoft.XMLHTTP") xml.Open "GET", sUrl, False xml.setRequestHeader "Content-Type", "text/html;charset=" & sCharSet xml.Send() If Err.Number <> 0 Then xmlHttp = "" Exit Function End If If xml.readyState = 4 Then xmlHttp = BytesToBstr(xml.responseBody, sCharSet) End If End Function
Function BytesToBstr(cnvUni, sCharSet) On Error Resume Next Dim objStream: set objStream = Server.CreateObject("adodb.stream") With objStream .Type = 1 .Mode = 3 .Open .Write cnvUni .Position = 0 .Type = 2 .Charset = sCharSet BytesToBstr = .ReadText .Close End With End Function
更多的小偷经典教程之解决XML读取UTF-8 乱码请到论坛查看: http://BBS.TC711.COM
【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】
来源:
互联网
日期:2008-7-25
|
|
|
|
| 精品推荐 |
|
 |
| 本月推荐 |
|
 |
| 友情赞助 |
|
|
|