日期:2014-05-18  浏览次数:20365 次

responseBody 后
在xmlhttp.responseBody 后,需要用下面VB函数才能吧gb2312编码的网页内容,转换成utf-8编码,并且正常显示。 

现在问题是我 要读取的网页已经是utf-8的了。用responseBody 获取后,我只要想吧responseBody这个流 解码成 UTF-字符串不安就行了,不用解码成GB2312 ,怎么做呢?? 


<script language="vbscript"> 
  function bytes2bstr(vin) 
  Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode  
  strReturn = ""  
  For i = 1 To LenB(vIn)  
  ThisCharCode = AscB(MidB(vIn,i,1))  
  If ThisCharCode < &H80 Then  
  strReturn = strReturn & Chr(ThisCharCode)  
  Else  
  NextCharCode = AscB(MidB(vIn,i+1,1))  
  strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))  
  i = i + 1  
  End If  
  Next 
  bytes2BSTR = strReturn 
  End Function  

  </script>

------解决方案--------------------
朋友,你不是说你转行卖内衣去了么?难道是在给自己的内衣店做个网站?