ServerXMLHTTP and question marks Problem

D

Dana

I am having a problem with the following code:

Response.CharSet = "UTF-8"
url = "http://www.domain.com/myisapi.dll"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/HTML"
xmlhttp.setRequestHeader "CharSet", "UTF-8"
xmlhttp.send "param=1"
txt = xmlhttp.responsetext

The request is sent properly to the page (myisapi.dll) but the returned
valued is not correct!!

Characters over 127 ascii, will be converted to question marks, even though
I changed the Response.CharSet

To test it, you can change the code to the following:

Response.CharSet = "UTF-8"
url="http://www.google.fr/"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.setRequestHeader "Content-Type", "text/HTML"
xmlhttp.setRequestHeader "CharSet", "UTF-8"
txt = xmlhttp.responsetext

You will see some question marks which got converted since they were over
127.

Any ideas!!!



Dana
 
M

Martin Honnen

Dana said:
I am having a problem with the following code:

Response.CharSet = "UTF-8"
url = "http://www.domain.com/myisapi.dll"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/HTML"
xmlhttp.setRequestHeader "CharSet", "UTF-8"
xmlhttp.send "param=1"
txt = xmlhttp.responsetext

The request is sent properly to the page (myisapi.dll) but the returned
valued is not correct!!

Characters over 127 ascii, will be converted to question marks, even though
I changed the Response.CharSet

responseText with XMLHTTP and MSXML is not very helpful to receive the
response from an abritrary web page and decode it, it can and does deal
with Unicode encodings like UTF-8 but it does not decode any ISO-8859-x
encoding for instance, it assumes an Unicode encoding and only looks for
a BOM (byte order mark).
Documentations is here:
<http://msdn.microsoft.com/library/d...html/b035fdea-8665-4d7b-80f0-3624d269e7b6.asp>

Depending on what you want to do it might be possible to use
responseBody or responseStream instead of responseText e.g. within ASP
Response.BinaryWrite xmlhttp.responseBody
might do to output the response body XMLHTTP received.
 
D

Dana

Thank for the reply.

I managed to use the responseBody then convert it to a string value.



Dana
 
E

Egbert Nierop \(MVP for IIS\)

Dana said:
I am having a problem with the following code:

Response.CharSet = "UTF-8"
url = "http://www.domain.com/myisapi.dll"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/HTML"
xmlhttp.setRequestHeader "CharSet", "UTF-8"
xmlhttp.send "param=1"
txt = xmlhttp.responsetext

The request is sent properly to the page (myisapi.dll) but the returned
valued is not correct!!

This is because

<% @codepage=65001%>
should be set as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top