Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ServerXMLHTTP and question marks Problem

Reply
Thread Tools

ServerXMLHTTP and question marks Problem

 
 
Dana
Guest
Posts: n/a
 
      11-10-2005
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


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      11-10-2005


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/
 
Reply With Quote
 
 
 
 
Dana
Guest
Posts: n/a
 
      11-11-2005
Thank for the reply.

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



Dana


"Martin Honnen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
>
> 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/



 
Reply With Quote
 
Egbert Nierop \(MVP for IIS\)
Guest
Posts: n/a
 
      11-11-2005

"Dana" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ServerXMLHTTP and impersonation Lambuz ASP General 10 01-30-2006 11:54 AM
ServerXMLHTTP and Double-byte Encoding Jen ASP General 1 12-21-2005 09:47 PM
msxml2.serverXMLhttp and response.binarywrite katrinaVictim@. ASP General 4 10-17-2005 02:34 PM
not dust marks - water marks! pshaw@emmet.com Digital Photography 0 04-14-2005 05:53 AM
nuby question: question marks in method names Edwin Eyan Moragas Ruby 0 08-30-2004 07:11 AM



Advertisments