Feed RSS and accented and other special chars

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello to all,

I've a problem that's making me moderately mad.

I need to generate a feed RSS, but i have to take data from tables
containing a lot of different vowels, special chars and so on.

If I use http://www.ajaxray.com/blog/2008/03/08/php-universal-feed-generato =
in plain way, I obtain a feed RSS that's bugged, where bug (according
to IE) corresponds to the first character containing &

I thought i simply needeed to escape the vowels.

If i put a simple code snippet like this:
    $titolo = str_replace("=E0", "& agrave;'", $row['titolo']);
it's not working.
In fact, the feed RSS is correctly generated but it writes & a grave;
(note that the letters are voluntery spaced to avoid unwanted
substitutions in browser)

Main question: Why this behaviour and , is there a way to exit from
this hell?

Not-so-secondary Question:
How to transform each hex code in a html entity in the cycle?

Thanks to all!!

Re: Feed RSS and accented and other special chars

El 22/09/2010 16:28, Luk escribi/wrote:
Quoted text here. Click to load it

Rather than "bug", we are talking about invalid XML. It'd be interesting
to inspect the XML source code and the exact error message.

Quoted text here. Click to load it

The problem is that computers can only handle binary numbers (but not
letters) and there isn't a universal mapping between letters and
numbers. Instead, you have a few hundred mappings called character sets
(or charsets).

Most likely, you want to generate an XML document that uses the UTF-8
charset. That's a nice option: it's widely supported and it can
represent almost any character that exists. However, there's an
important pre-requisite when you work with charsets: you must find out
what charset your app is using so you can decide whether you need to
perform any sort of conversion. Can you obtain that information?

Quoted text here. Click to load it

Are you sure you need HTML entities in the first place?

-- http://alvaro.es - lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programacin web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com

Site Timeline