Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16119

Re: Diactric in CDATA in XML reponse

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="ISO-8859-1"
Message-ID <35486874.FMhRtqDPO2@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Sat, 22 Sep 2012 16:46:49 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 7Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Diactric in CDATA in XML reponse
Newsgroups comp.lang.javascript
References <505cc8dc$0$6885$e4fe514c@news2.news.xs4all.nl> <1621260.MulQa8nmlF@PointedEars.de> <505db945$0$6958$e4fe514c@news2.news.xs4all.nl>
Followup-To comp.lang.javascript
MIME-Version 1.0
Lines 62
NNTP-Posting-Date 22 Sep 2012 16:46:50 CEST
NNTP-Posting-Host 4746fa95.newsspool3.arcor-online.net
X-Trace DXC=Q9FU6CFH2XQHigV@eW57PQMcF=Q^Z^V3X4Fo<]lROoRQ8kF<OcfhCO[Q^kYTE\6d>QDZm8W4\YJN\R=i2=[N6Y6ZR;MTI932AZUgh9jY<i=o2V
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:16119

Followups directed to: comp.lang.javascript

Show key headers only | View raw


Tom de Neef wrote:

> "Thomas 'PointedEars' Lahn wrote:
>>> I encounter a situation where the responseXML of a XMLHttpRequest
>>> contains a CDATA element, like:
>>>
>>> <xml><mod><![CDATA[some text]]></mod></xml>
>>>
>>> This is used to load data in a table. It works always in FF and in
>>> Chrome.
>>> But in IE8 the table is not always loaded.
>>> It took me a while to find that the problem is related to the presence
>>> of a diacritic (ASCII>128) in the CDATA text block. In such cases the
>>> responseXML is returned by IE with firstChild=null.
>>
>> It might be helpful for further diagnosis that the referred document
>> object implements the IXMLDOMDocument interface which provides an `xml'
>> property for its XML serialization. [1]
> 
> I guess it does:
>   var asyncRequestor = new XMLHttpRequest();

Refuse the temptation to guess.

>>> My question is how to handle this. I presume that I need to specify the
>>> encoding somewhere.
>>
>> Make sure that your XML data uses one of the character encodings that XML
>> applications must support (UTF-8 and UTF-16), or declare the used
>> character encoding. [2]  Not doing that and having incompatible code
>> sequences in the XML data leads to the XML document being empty.
>>
>> Generally, UTF-8 is the best choice for XML data because it can encode
>> all Unicode characters without using character references (such as
>> &#x20AC; for the Euro sign), is widely supported, and in most cases has
>> the smallest footprint while having all these properties.
> 
> I have added encoding so that the xml string no reads
> <xml>
>   <?xml version="1.0" encoding="utf-8" ?>
>   <mod><![CDATA[some text]]></mod>
> </xml>
> 
> This seems to work!

That would be negatively surprising, since it is _not_ Valid.  AISB, the 
declaration must come *before* the root element (here: `xml'), and declaring 
UTF-8 is not necessary because it is one of the defaults.  What matters is 
that the encoding declaration, if any, matches the encoding of the data.
I can see no relevant change there.

> Thank you.

You are welcome, but you are _not_ done there yet.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Diactric in CDATA in XML reponse "Tom de Neef" <tdeneef@qolor.nl> - 2012-09-21 22:06 +0200
  Re: Diactric in CDATA in XML reponse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-22 03:46 +0200
    Re: Diactric in CDATA in XML reponse "Tom de Neef" <tdeneef@qolor.nl> - 2012-09-22 15:12 +0200
      Re: Diactric in CDATA in XML reponse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-22 16:46 +0200
        Re: Diactric in CDATA in XML reponse "Tom de Neef" <tdeneef@qolor.nl> - 2012-09-22 19:31 +0200
          Re: Diactric in CDATA in XML reponse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-22 21:12 +0200

csiph-web