title: PHP Multi Byte str_replace?
body: <p>I'm trying to do accented character replacement in PHP but get funky results, my guess being because i'm using a UTF-8 string and str_replace can't properly handle multi-byte strings..</p>
  
  <pre><code>$accents_search     = array('á','à','â','ã','ª','ä','å','Á','À','Â','Ã','Ä','é','è',
  'ê','ë','É','È','Ê','Ë','í','ì','î','ï','Í','Ì','Î','Ï','œ','ò','ó','ô','õ','º','ø',
  'Ø','Ó','Ò','Ô','Õ','ú','ù','û','Ú','Ù','Û','ç','Ç','Ñ','ñ'); 
  
  $accents_replace    = array('a','a','a','a','a','a','a','A','A','A','A','A','e','e',
  'e','e','E','E','E','E','i','i','i','i','I','I','I','I','oe','o','o','o','o','o','o',
  'O','O','O','O','O','u','u','u','U','U','U','c','C','N','n'); 
  
  $str = str_replace($accents_search, $accents_replace, $str);
  </code></pre>
  
  <p>Results I get:</p>
  
  <pre><code>Ørjan Nilsen -&gt; �orjan Nilsen
  </code></pre>
  
  <p>Expected Result:</p>
  
  <pre><code>Ørjan Nilsen -&gt; Orjan Nilsen
  </code></pre>
  
  <p>Edit: I've got my internal character handler set to UTF-8 (according to mb_internal_encoding()), also the value of $str is UTF-8, so from what I can tell, all the strings involved are UTF-8. Does str_replace() detect char sets and use them properly?</p>