Monday, December 19, 2011

Microsoft.XMLHTTP responseText return question mark

Microsoft.XMLHTTP responseText return question mark

responseText actually doesnt support for non ascii character... the alternative is you can get the binary ( responseBody ) and covert to string. Example like below.


function bin2str(vt_array)
      dim idx, tmpStr
      for idx = 1 To LenB(vt_array)
            tmpStr = tmpStr & Chr(AscB(MidB(vt_array, idx, 1)))
      next
      bin2str = tmpStr
end function

Dim objH, str
' Create an xmlhttp object:
Set objH = Server.CreateObject("Microsoft.XMLHTTP")
objH.Open "GET", "http://www.test.com/test.asp", False
     
' Send the request and return the data:
objH.Send
str = bin2str(objH.responseBody)
response.write Server.HTMLEncode(str)


keyword: asp,  Microsoft.XMLHTTP, responseText, question mark, responseBody

No comments:

Post a Comment