Invalid character in rss.php output

From: Date: Wed, 27 Aug 2003 05:49:06 +0000
Subject: Invalid character in rss.php output
Groups: php.pear.webmaster 
Request: Send a blank email to pear-webmaster+get-476@lists.php.net to get a copy of this message
An invalid character was found in text content. Error processing resource 'http://pear.php.net/rss.php'. Line 21, Position 68 stable for a while and been used in some real-life applications. We This turns out to be some sort of strange ` char. Prolly happened 'cause the text was pasted into the dialog. It's a hex(B4) char, whiche, I've noticed at work in code I've written, makes XML streams barf. Testing showed me that basicly everything above HEX(80) made an XML barf, so I wrote the following code to fix it. Feel freee to use it, YMMF. function charsToValidXML($html){ $codes = get_html_translation_table(HTML_ENTITIES); unset($codes['>']); unset($codes['<']); unset($codes['"']); unset($codes['&']); $char = 127; while ($char < 255){ $codes[chr($char)] = "&#0" . $char; $char++; } $html = strtr($html, $codes); return $html; } Cipri

« previous php.pear.webmaster (#476) next »