Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: MSXML4 ServerXMLHTTP.4.0 encoding issue with responseText [Thread Next] Re: MSXML4 ServerXMLHTTP.4.0 encoding issue with responseTextTo: 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/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
