Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the DB on the receiving server?
views:
569answers:
4
A:
Ive been using htmlentities/html_entity_decode but for some reason it doesnt work with the parser. In a normal test it works, but parser always returns html code without < > " characters.
Yegor
2008-09-22 03:39:03
A:
RSS is XML. It has very specific rules for encoding HTML. If you're generating it, I'd recommend using an xml library to write the node containing HTML, to be sure you get the encoding right.
HTMLencode will only perform the escaping necessary for embedding data within HTML, XML rules are more strict.
davenpcj
2008-09-22 03:47:14
which one would you recommend?
Yegor
2008-09-22 03:57:32
libxml is freely available, but there are PHP modules that read/write XML, and xml libraries for most languages.
davenpcj
2008-09-23 14:58:32
This will break if there's a CDATA section (or just "]]>" ) in the HTML. It's valid to do, but maybe an error case you don't want to handle since you're just looking at embedding a flash player.
davenpcj
2008-09-23 15:02:47