title: problem with rss feed and cdata
body: <p>I have a problem with an rss feed. </p>
  
  <p>When i do  <code>&lt;title&gt;This is a title &lt;/title&gt;</code></p>
  
  <p>The title appears nicely in the feed </p>
  
  <p>But when i ddo 
  $title = "this is a tilte";</p>
  
  <pre><code>&lt;title&gt;&lt;![CDATA['$title']]&gt;&lt;/title&gt;
  </code></pre>
  
  <p>The title doesn't appear at all.</p>
  
  <hr/>
  
  <p>It still doesn't work. I generate my rss feed dynamicly and it looks like this:</p>
  
  <pre><code>$item_template="
        &lt;item&gt;
           &lt;title&gt;[[title]]&lt;/title&gt;
           &lt;link&gt;[[link]]&lt;/link&gt;
           &lt;description&gt;&lt;![CDATA[[[description]]]]&gt;&lt;/description&gt;
           &lt;pubDate&gt;[[date]]&lt;/pubDate&gt;
        &lt;/item&gt;
        ";
  </code></pre>
  
  <p>and in a loop:</p>
  
  <pre><code>$s.=str_replace(
  array("[[title]]","[[link]]","[[description]]","[[date]]"),
  array(htmlentities($row["title"]),$url,$description,$date),
  $item_template);
  </code></pre>
  
  <p>The problem is specifically when the title has a euro sign. Then it shows up in my rss validator like:</p>
  
  <pre><code>Â\x80
  </code></pre>
  
  <hr>
  
  <p><strong>More detailed information:</strong></p>
  
  <p>Ok I have been struggeling with this for the last few days and I can't find a solution. So I will start a bounty. Here is more information:</p>
  
  <ul>
  <li>The information that goes in the feed is stored in a latin 1 database (which i administer)</li>
  <li>The problem appears when there is a euro sign in the database. No matter wether its like  € or <code>&amp;euro;</code></li>
  <li>The euro sign sometimes appears like weird charachters or like Â\x80</li>
  <li>I try to solve the problem on the feed side not on the reader side.</li>
  <li>The complete code can be found over here: <a href="http://codedump.mastercode.nl/622/" rel="nofollow noreferrer">codedump</a></li>
  <li>Next: sometimes when the euro sign cannot be parsed the item (either the title or description) is shown empty. So if you look in the source when showing the feed in an browser you'll find <code>&lt;title&gt;&lt;/title&gt;</code></li>
  </ul>
  
  <p>If there is more information needed please ask.</p>