Forum Discussion

EnTerr's avatar
EnTerr
Roku Guru
12 years ago

UTF-8, XML, URL, WTF etc

I am having problem with XML downloaded from a URL, being parsed differently in fw3 and fw5. Namely, on a firmware 3 box it seems to disregard UTF-8 encoding. Here is what i am doing:

xfer = createObject("roURLTransfer")
xfer.setURL(url)
data = xfer.getToString()
xml = createObject("roXmlElement")
xml.parse(data)
And then from the element i need, getText() returns the right thing on fw 5 and multi-character mishmash on fw 3. Considering how straightforward the code is, i can't think of anything wrong i might be doing.

Some more details:

  • HTTP response has "Content-Type:application/rss+xml; charset=utf-8"

  • XML starts with "<?xml version="1.0" encoding="UTF-8"?>"

  • the element in question, in the raw, is "<description><![CDATA[(408) ••• •••• 7days [...]]]></description>",
    displays as "(408) ••• •••• 7days [...]" on fw5 and
    something like "(408) ••• •••• 7days [...]" on fw3.

  • representative character i checked is "", AKA bullet (&bull; &#8226; U+2022) - it comes as ASC(mid(s, .., 1))=8226 on fw5 and as 3 chars with ASC( )=-30, -128, -94 on fw3 (which seems to be the UTF8 encoding of U+2022: E2 80 A2)

So, how can i get the right string on fw 3?
Can i read the URL any different, any setting i can trigger? (I have zero control over the server - but it is sending the right format anyway).
No RepliesBe the first to reply