Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: MSXML4 ServerXMLHTTP.4.0 encoding issue with responseText

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 10/1/2005 5:21:00 PM

wzhao2000@g... wrote:

> forgot to mention how I checked returned char: if the char is correct,
> it's displayed as " ß " in the WScript.Echo message box, otherwise
> it's displayed as " ß "

I have created a test XML document that is UTF-16 encoded and uploaded 
it here:
<http://home.arcor.de/martin.honnen/xml/test2005100101.xml>

Then I have written the following JScript program to be executed with 
WSH (e.g. cscript):

function checkXml (url) {
   var prefix = 'Msxml2';
   var versions = [ '3.0', '4.0', '5.0', '6.0'];
   var ids = ['XMLHTTP', 'ServerXMLHTTP'];
   var result = [];
   for (var i = 0; i < versions.length; i++) {
     var version = versions[i];
     for (var j = 0; j < ids.length; j++) {
       var id = ids[j];
       var programId = prefix + '.' + id + '.' + version;
       result.push('Requesting ' + url + ' with ' + programId + ':');
       try {
         var httpRequest = new ActiveXObject(programId);
         httpRequest.open('GET', url, false);
         httpRequest.send(null);
         result.push('HTTP status code: ' + httpRequest.status + ' ' + 
httpRequest.statusText);
         if (httpRequest.responseXML && 
httpRequest.responseXML.parseError.errorCode == 0) {
           result.push('responseXML serialized:');
           result.push(httpRequest.responseXML.xml);
         }
       }
       catch (e) {
         result.push('Error ' + e.message + ' with ' + programId);
       }
       result.push('\r\n');
     }
   }
   return result.join('\r\n');
}

function main () {
   for (var i = 0; i < WScript.Arguments.length; i++) {
     WScript.Echo(checkXml(WScript.Arguments(i)));
   }
}

main();

When I run that here from the command line as passing in the above URL 
as an argument I get the following flawless results for MSXML 3, 4, 5, 6:

Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.XMLHTTP.3.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.ServerXMLHTTP.3.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.XMLHTTP.4.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.ServerXMLHTTP.4.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.XMLHTTP.5.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.ServerXMLHTTP.5.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.XMLHTTP.6.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



Requesting http://home.arcor.de/martin.honnen/xml/test2005100101.xml 
with Msxml2.ServerXMLHTTP.6.0:
HTTP status code: 200 OK
responseXML serialized:
<?xml version="1.0" encoding="UTF-16"?>
<root>
         <text xml:lang="de">ß</text>
         <text xml:lang="de">ä</text>
</root>



So at least with responseXML I can't reproduce any problem. Do you get 
any different result for the sample XML document with your version of 
MSXML 4?
If not can you post a URL to an XML document that causes the problem 
with MSXML 4 ServerXMLHTTP?


Note the followup-to is set to microsoft.public.xml only.


-- 

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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent