title: UTF8 Errors on generating PHP SimpleXML RSS feed
body: <p>I'm creating an RSS feed for a site. </p>
  
  <p>I am using SimpleXML to create the XML structure. When I call $xml->asXML();, it throws many warnings:</p>
  
  <pre><code>ErrorException [ Warning ]: SimpleXMLElement::asXML() [simplexmlelement.asxml]: string is not in UTF-8
  </code></pre>
  
  <p>I'm not sure what this error is. The database table it is reading from is utf8_general_ci. I tried running utf_encode on the string which messed up the strings instead of fixing it.</p>
  
  <pre><code>//First create the XML root
  $xml = new SimpleXMLElement('&lt;rss version="2.0"&gt;&lt;/rss&gt;');
  
  //Create the Channel
  $channel = $xml-&gt;addChild('channel');
  
  //Construct the feed parameters
  $channel-&gt;addChild('title', 'CGarchitect Feed');
  $channel-&gt;addChild('link', Config::get('base_url'));
  $channel-&gt;addChild('description', 'CGarchitect is the leading online community for architectural visualization professionals.');
  $channel-&gt;addChild('pubDate', date("D, d M Y H:i:s T"));
  
  //Get the feed items
  
  $nodes = &lt;....snip... &gt;
  
  foreach ($nodes as $node)
  {
  
      //Parse the title and description
      $title = htmlentities(strip_tags($node-&gt;title));
      $description = htmlentities(strip_tags($node-&gt;description));
      $newItem = $channel-&gt;addChild('item');
      $newItem-&gt;addChild('title', $title);
      $newItem-&gt;addChild('description', $description);
      $newItem-&gt;addChild('pubDate', date("D, d M Y H:i:s T", $node-&gt;published_at));
  
  }
  
  header('Content-Type: application/xhtml+xml');
  echo $xml-&gt;asXML();
  </code></pre>
  
  <p>Thanks in advance...</p>
  
  <p>Leonard</p>