title: I want to remove invalid characters from a wanabee XML file using PHP
body: <p>I want to remove invalid characters from an HTML file which is fetched from the web to be changed to an XML format. </p>
  
  <p>I can't  change the source code, and doing it manually is not an option because I have to deal with hundreds of files per day.</p>
  
  <p>I had been doing well until some of the HTML files showed up with a special character that is invalidating the code.</p>
  
  <p>When I load the pretending XML file I get from the browser a warning </p>
  
  <pre><code>"This page contains the following errors:
  
  error on line 137 at column 1: PCDATA invalid Char value 7
  Below is a rendering of the page up to the first error."
  </code></pre>
  
  <p>After digging for the invalid character with a text editor I found: ⟩, a character apparently named: <a href="http://tunes.org/wiki/html_20special_20characters_20and_20symbols.html" rel="nofollow">&amp;rang, &amp;lang</a>, or maybe <a href="http://bundlr.com/b/special-characters" rel="nofollow">&amp;#9679</a>, which is causing the problems.</p>
  
  <p>I have tried to remove it with PHP but doesn't work.</p>
  
  <pre><code>//create arrays 
  $find = array ('#&amp;nbsp;#','#list#','#&amp;rang;#'); 
  $replace = array ('','',''); 
  
  //replace with array values 
  $list = preg_replace($find, $replace, $boletin_saveAsXml); 
  </code></pre>
  
  <p>Any advise will be greatly appreciated :)</p>