[PHP] HTMLEntities as NUMERIC for XML
After reading this: http://validator.w3.org/feed/docs/error/UndefinedNamedEntity.html (all praise W3.org!) I am searching for a PHP library function that will convert all my abc; into #123; I have a zillion of these things from converting stupid MS Word characters into something that will, like, you know, actually WORK on the Internet, and do not really want to re-invent the wheel here. Somebody has to have written this function... I'm kind of surprised it's not http://php.net/xmlentities or somesuch... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HTMLEntities as NUMERIC for XML
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2008 11:28 AM To: php-general@lists.php.net Subject: Re: [PHP] HTMLEntities as NUMERIC for XML I came across a similar problem using an AJAX thing, with MSWord characters in the text. The way round the problem was to enclose everything inside CDATA blocks, which made the browsers happy to receive as the entities only had to be understood by the HTML browser now, not the XML parser. As RSS is an XML format, maybe this would help you? I suspect not. The RSS+XML standard[1] seems to be quite finicky, and wrapping in CDATA block, from what I've read, will simply make some readers/aggregators decide to not carry the RSS feed at all. I have no idea if some means a handful or most however. But trying to maximize audience, I'm being conservative and using KISS principle until I know more. [1] Actually, it's 9 different incompatible standards, with no two published RSS standards being compatible: http://diveintomark.org/archives/2004/02/04/incompatible-rss I personally found this blog post brilliant YMMV You are correct. Some feed readers will just throw everything in a ![CDATA[]] block away. It can be useful when you are the only one reading/manipulating the XML ... but getting it into a universal code page is the way to go if aggregators are going to be touching your content. My 2c, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTMLEntities as NUMERIC for XML
I came across a similar problem using an AJAX thing, with MSWord characters in the text. The way round the problem was to enclose everything inside CDATA blocks, which made the browsers happy to receive as the entities only had to be understood by the HTML browser now, not the XML parser. As RSS is an XML format, maybe this would help you? I suspect not. The RSS+XML standard[1] seems to be quite finicky, and wrapping in CDATA block, from what I've read, will simply make some readers/aggregators decide to not carry the RSS feed at all. I have no idea if some means a handful or most however. But trying to maximize audience, I'm being conservative and using KISS principle until I know more. [1] Actually, it's 9 different incompatible standards, with no two published RSS standards being compatible: http://diveintomark.org/archives/2004/02/04/incompatible-rss I personally found this blog post brilliant YMMV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php