tags:

views:

52

answers:

3

I have a lot of data that contains characters that will normally break RSS. Is there a function or library in PHP that will handle these characters so they are suitable to be printed in an RSS Feed?

+1  A: 

RSS is simply XML. So the characters escaped by htmlspecialchars() should be sufficient or htmlentities() escapes some extra characters, which might be useful.

Brenton Alker
A: 

http://php.net/manual/en/function.htmlentities.php

Take a look at the comments, there are some xmlentities functions there you can use (since RSS is XML).

Amber
A: 

Use htmlentities() and it will encode the strange character in a strange encoding but it wouldn't break RSS.

ZZ Coder