OK, first of all I am outputting an xml representation of a string as part of a javascript declaration which will define that string on the client where it can then be parsed into an xml object that the browser can work with.
The reason why I care about the encoding of the string is because apparently quite a few computers have an old version of msxml.dll registered as their xml parser for IE and according to the MS knowledge base article I posted the other day (http://support.microsoft.com/kb/275883) msxml.dll is ONLY COMPATIBLE with UTF-16 and UCS-2. "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." Secondly, forget that I typed cfsavecontent. That was a typo. I meant cfcontent as was exampled in the live docs link I included. I am using cfxml to create the XML object, and tostring to create a string representation of that object to pass along to JavaScript. According to Adobe UTF-8 is the ONLY encoding that tostring will produce for xml documents. Now we have our problem. Tostring forces my xml to be encoded as utf-8, but everyone's computer with IE who is running "MSXML parser versions 2.5, 2.5 SP1 and 2.6" CANNOT parse that string. My only choices are to 1) Run "regsvr32 /s %WINDIR%\system32\msxml3.dll" to upgrade them to MSXML 3.0 2) Encode my XML as UTF-16 or UCS-2 so everyone's browser can handle it. My frustration is with the back-door sort of kludgy way I am supposed to "convert" my xml string-- by finding and replacing the encoding value. That just seems kind of lame. I will suggest it to Adobe. I would like to note that the tostring function already accepts an encoding parameter but apparently it only applies to binary data. Also, I am a little confused on exactly how the <cfcontent type="text/xml; charset=utf-16"> will work. You see, I don't want to encode the entire output of my page as utf-16-- JUST the xml string. It is my impression that using the cfcontent tag will reset the ENTIRE page to use that encoding. All I want is a single coldfusion string variable to contain utf-16 encoded xml. Here is code for those interested: <cfxml variable="aTabInfoList" caseSensitive="no"> ...SNIP... </cfxml> <script language="JavaScript" type="text/javascript"> <!--- I want to be able to pass this via Ajax when to get tab data. No need to go back to the database again for this info. ---> <cfset string_all_tabs = tostring(aTabInfoList)> <!--- Retarted Mozilla thinks white space chars are text nodes. ---> <cfset string_all_tabs = rereplacenocase(string_all_tabs,"(>)(\s*)(<)","\1\3","all")> <!--- IF the user has an out dated dll registered for Microsoft.XMLDOM then IE cannot parse UTF-8 encoded XML ---> <cfset string_all_tabs = replacenocase(string_all_tabs,"UTF-8","UTF-16","one")> var string_all_tabs = '<cfoutput>#jsstringformat(string_all_tabs)#</cfoutput>'; // code for IE if (window.ActiveXObject) { var doc=new ActiveXObject("Microsoft.XMLDOM"); doc.async="false"; doc.loadXML(string_all_tabs); var objParseError = doc.parseError; if ( objParseError.errorCode != 0 ) { // TODO: Log error with JS error logging. alert('Error: Your computer needs to be updated to be able to display this page correctly. We apologize for the inconvenience.\nPlease call the helpdesk at <cfoutput>#jsstringformat(request.helpdesk_number)#</cfoutput> so they can register a new XML parser.\n\n\n'+'Error Code: '+objParseError.errorCode+'\nError Message: '+ objParseError.reason); //alert(objParseError.errorCode); //alert(objParseError.reason); } } // code for Mozilla, Firefox, Opera, etc. else { var parser=new DOMParser(); var doc=parser.parseFromString(string_all_tabs,"text/xml"); }// documentElement always represents the root node var xml_all_tabs = doc.documentElement; </script> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281197 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4