Hey, this ties back to my post the other day
((http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:51988)
I was messing around with it today to try to go back and do some error
checking to display a message to the user if their browser wasn't going
to be able to handle XML correctly.
I added parseError stuff to the code:
var doc=new ActiveXObject("Microsoft.XMLDOM");
doc.async="false";
doc.loadXML(string_all_tabs);
var objParseError = doc.parseError;
if ( objParseError.errorCode != 0 )
{
alert(objParseError.errorCode);
alert(objParseError.reason);
}
}
The actual error is "Switch from current encoding to specified encoding
not supported." Which according to this MS knowledge Base article
(http://support.microsoft.com/kb/275883) is thrown when a computer has
an older version of the parser. And I quote...
"With the MSXML parser versions 2.5, 2.5 SP1 and 2.6, the loadXML method
of IXMLDOMDocument can only load UTF-16 or UCS-2 encoded data. Any
attempt to load XML data that is encoded with another encoding format
results in the following error:
Switch from current encoding to specified encoding not supported.
With the release of MSXML 3.0 (Msxml3.dll), this restriction is removed,
and the following code runs without error:
hr = pXMLDoc->loadXML("<?xml version=\"1.0\"
encoding=\"UTF-8\"?><tag1>Abcdef</tag1>");"
This all reinforces what I found the other day. So you're probably
thinking, what the heck does this have to do with CF...
If I know for a fact that certain IE users out thee have an older
msxml.dll registered which is incapable of parsing utf-8 encoded XML,
then I should output it in utf-16 or something which I know is
compatible. How do I do that? I am simply using the tostring()
function in CF to output my xml doc as a string. The optional encoding
parameter only applies to binary data, and I don't know how to change
the CF default to be something other than utf-8. It appears that CF
will ONLY tostring an xml document with utf-8 encoding even though that
is incompatible with some people's xml parsers. Ideas?
~Brad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281083
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4