I am trying to develop my own XML RSS feed based on PHP output from MySQL queries. However I keep getting "entity X not defined" error messages for all the ASCII characters in my DB content fields, even though I have set everything to UTF8 encoding and charset (database connection, xml version, utf8_encode), but nothing removes the error:
<?php
$connection = mysqli_connect( .... )
$connection->set_charset("utf8");
header("Content-type: text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<rss version="2.0">';
$query = mysqli_query($connection,"SELECT * FROM news ORDER BY pubdate DESC LIMIT 10");
while($row = mysqli_fetch_assoc($query)){
$title = utf8_encode($row['title']);
$content = utf8_encode($row['content']);
echo '<item><title>'.$title.'</title>';
echo '<description>'.$content.'</description></item>';
} // end while
echo '</channel>';
echo '</rss>';
?>
What am I missing?
Thanks a lot!