Welcome to WebmasterWorld Guest from 54.145.208.64

Forum Moderators: bill & werty

Message Too Old, No Replies

Help: Escaping Text/HTML for an RSS Feed

What's the best way to escape Text/HTML using PHP?

   
6:47 pm on Mar 5, 2005 (gmt 0)

10+ Year Member



I've created an RSS 2.0 Feed for a friend of mine using PHP and MySQL. The author writes a ton of articles. I've worked out all the details of creating the feed in PHP, except for escaping characters for XML/RSS.

What's the best way to escape Text/HTML for an RSS 2.0 Feed using PHP? Can RSS descriptions contain HTML?

And... How might I escape out those "Mikrsooft" characters that I know the author will copy into the RSS descriptions?

Thanks in advance,
Jeff

3:39 am on Mar 8, 2005 (gmt 0)

10+ Year Member



hmmm.... I guess nobody knows... Or is this posted in the wrong forum?
4:47 am on Mar 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think this is the correct forum, but I do now if anyone knows the answer.
11:37 am on Mar 8, 2005 (gmt 0)

10+ Year Member



You do need escape characters in an RSS Feed. You can use The codes that start with &xx; etc. There are only a few you really need to consider ie < >

You can use html in an RSS feed, in my opinion though you should not use them as the feeds will be parsed and the user should decide how to view them.

You can also use cdata[] within your feed, it means all chsracters between the brackets should be shown as literal ie you do not need to use escape characters.

Do a search on google, there is some info out there.