ServerXMLHTTP and question marks Problem

Dana (3)

Usenet Archive
Joined
Nov 10, 2005
Messages
3
Reaction score
0
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
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
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.
 

Dana (3)

Usenet Archive
Joined
Nov 10, 2005
Messages
3
Reaction score
0
Thank for the reply.

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

Dana
 
Joined
Jul 7, 2003
Messages
281
Reaction score
0
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

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top