FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Feed RSS and accented and other special chars
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Feed RSS and accented and other special chars [message #169677 is a reply to message #169675] Wed, 22 September 2010 15:40 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 22/09/2010 16:28, Luk escribió/wrote:
> 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-generator-support s-rss-10-rss-20-and-atom/
> in plain way, I obtain a feed RSS that's bugged, where bug (according
> to IE) corresponds to the first character containing&

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


> I thought i simply needeed to escape the vowels.
>
> If i put a simple code snippet like this:
> $titolo = str_replace("à", "& agrave;'", $row['titolo']);
> it's not working.
> In fact, the feed RSS is correctly generated but it writes& a grave;
> literally
> (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?

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?


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

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



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Previous Topic: Not bale to connect to MySQL with PHP
Next Topic: empty __FILE__ in quercus
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 16:26:45 GMT 2024

Total time taken to generate the page: 0.05222 seconds