473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ServerXMLHTTP and question marks Problem

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
Nov 10 '05 #1
3 15229


Dana wrote:
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/default.asp?url=/library/en-us/xmlsdk/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.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 10 '05 #2
Thank for the reply.

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

Dana
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...


Dana wrote:
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/default.asp?url=/library/en-us/xmlsdk/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.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Nov 11 '05 #3

"Dana" <Da**@atasoft.com> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
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.
Nov 11 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: katrinaVictim | last post by:
Question: I get the eror listed at the bottom of the post. What can I do to make the response of the x1.send a "binary" type? Or, in general, how can I just "make this work"? <%@...
2
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking...
8
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the html for the logon user's default page. We've...
7
by: Ed McNierney | last post by:
I'm trying to use ServerXMLHTTP on an ASP (not ASP.NET) page to retrieve large binary data from a remote server. When the request is large (more than a few megabytes), the ServerXMLHTTP page jumps...
1
by: Jen | last post by:
Hello, I am trying to use ServerXMLHTTP to post data containing Japanese characters, but the data posts as question marks, boxes or just random ascii characters. Here is the code I am using:...
10
by: Lambuz | last post by:
Hi all, I'm trying to use a ServerXMLHTTP connection in async mode to request Page2.asp from Page1.asp. Both pages are inside 2 different virtual directories with Windows Integrated...
9
by: John Stivenson | last post by:
I'm using PHP 4.3.10 & MySQL 4.1.9. When I read UTF-8 string from database and echo it to the page I get only question marks. The number of question marks is equal to the real length of the...
10
by: perochak | last post by:
Write a C++ program to calculate the GPA of students. Your program should contain a class named Gpa. The class should have an array named result, as its data member. This array is meant to take...
1
by: niklang | last post by:
Hi everybody, I have an ASP page that uses the MSXML2.ServerXMLHTTP object to read a stylesheet from IIS as follows: strXSLPath = "http://localhost/ej/ejdetail.xsl.asp" ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.