0

I'm using PHP to generate an RSS feed which contains description texts located in files stored on a server. The problem is, the files are all encoded differently, some UTF-8, us-ascii, etc. What's a good way to unify the encoding of each description?

I already tried this, but I'm still getting an error in the XML file.

Here's the error My code

<channel>
<?php
    mysql_connect(xxx);
    mysql_select_db(xxx);
    $result = mysql_query("SELECT * FROM articles");
    while ($row = mysql_fetch_array($result)) {
        echo "<item>";
        echo "<description>";
        echo file_get_contents($row['location']); 
        echo "</description>";
        #The location to the file containing the article is in the DB, clearly.
        echo "<title>";
        echo $row['title'];
        echo "</title>";
        echo "<link>";
        echo "[link to entry goes here...]";
        echo "</link>";
        #Echo some more RSS tags that I don't need to specify in this example. 
        echo "</item>";
?>
</channel>
Community
  • 1
  • 1

0 Answers0