title: Encoding in UTF-8
body: <p>I need to get an XML file from some CRM software.</p>
  
  <p>The XML file encoding is in UTF-8, but some "strange" characters are present, and I can't parse the file with <code>simple_xml</code> due to these characters.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;ROW ART_LIB="CAT NxA1 2008"  /&gt;
  </code></pre>
  
  <p>the "xA1" char is present. What is it, and how do I encode it to the "good" character?</p>
  
  <p>The good result to be parsing is:</p>
  
  <pre><code>&lt;ROW ART_LIB="CAT N° 2008"  /&gt;
  </code></pre>
  
  <p>So, actually, to parse the XML file, I do that:</p>
  
  <pre><code>$fichier = utf8_encode(file_get_contents($inputfileName));
  $xmlInput = simplexml_load_string($fichier);
  </code></pre>
  
  <p>How can I fix it?</p>
  
  <hr/>
  
  <p>Thanks to the help of Jason Coco, I've fix the problem to do it:</p>
  
  <pre><code>function mac_roman_to_iso($string)
  {
      return strtr($string,
          "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa1\xa4\xa6\xa7\xa8\xab\xac\xae\xaf\xb4\xbb\xbc\xbe\xbf\xc0\xc1\xc2\xc7\xc8\xca\xcb\xcc\xd6\xd8\xdb\xe1\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf1\xf2\xf3\xf4\xf8\xfc\xd2\xd3\xd4\xd5Ð",
          "\xc4\xc5\xc7\xc9\xd1\xd6\xdc\xe1\xe0\xe2\xe4\xe3\xe5\xe7\xe9\xe8\xea\xeb\xed\xec\xee\xef\xf1\xf3\xf2\xf4\xf6\xf5\xfa\xf9\xfb\xfc\xb0\xa7\xb6\xdf\xae\xb4\xa8\xc6\xd8\xa5\xaa\xba\xe6\xf8\xbf\xa1\xac\xab\xbb\xa0\xc0\xc3\xf7\xff\xa4\xb7\xc2\xca\xc1\xcb\xc8\xcd\xce\xcf\xcc\xd3\xd4\xd2\xda\xdb\xd9\xaf\xb8\x22\x22\x27\x27-");
  }
  
  $fichier = mac_roman_to_iso(file_get_contents($fichier));
  $xmlInput = simplexml_load_string(utf8_encode($fichier));
  </code></pre>
  
  <p>And after, encode the value from ISO-8859-1 to UTF-8 with iconv().</p>