| WebClaus 2008-02-25, 7:09 pm |
| Hi folks,
Trying to digest the feed available at
http://www.thepost.ohiou.edu/rss.php?channel=1 I'm experiencing some
problems with encoding.
Here's a ready to cut'n'paste example:
<?php
$url = 'http://www.thepost.ohiou.edu/rss.php?channel=1';
include_once('XML/Feed/Parser.php');
try {
$xfp = new XML_Feed_Parser(file_get_contents($url))
;
include_once('HTML/Page.php');
$page = new HTML_Page(array('charset' => 'utf-8'));
$page->addBodyContent('<dl>');
foreach($xfp as $item) {
$page->addBodyContent('<dt>' . $item->title() . '</dt><dd>' .
$item->content() . '</dd>');
}
$page->addBodyContent('</dl>');
$page->display();
} catch( Exception $e ) {
die($e->getMessage());
}
?>
The content encoding that shows up on the page is screwed. I can do a
__toString() on each item and see that the XML is preserved fine as
UTF-8, so I'm thinking that XML_Feed_Parser is messing it up? Other
feeds work fine, so can it be because of the xhtml divs used within the
content elements?
Best,
Claus
|