title: Why does str_replace not correctly replace these extended ascii characters?
body: <p>This is a UTF-8 encoded source file. I must be missing something obvious, but I've tried all the permutations I can think of.</p>
  
  <pre><code>&lt;?php
  
  $bad =  array( chr(130), chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(173), chr(160) );
  $good = array( chr( 44), chr( 39), chr( 39), chr( 34), chr( 34), chr( 45), chr( 45), chr( 45), chr( 32) );
  
  print_r($bad);
  print_r($good);
  
   $str = &lt;&lt;&lt;EOF
      bad comma ‚
      bad quote ‘
      bad quote ’
      bad quote “
      bad quote ”
      bad dash –
      bad dash —
      bad dash ­
      bad space   
  
  EOF;
      echo $str;
      $clean = str_replace($bad, $good, $str);
      echo "\n";
      echo( $clean);
  </code></pre>
  
  <p>And when I open it in a browser and view source...</p>
  
  <pre><code>Array
  (
      [0] =&gt; ‚
      [1] =&gt; ‘
      [2] =&gt; ’
      [3] =&gt; “
      [4] =&gt; ”
      [5] =&gt; –
      [6] =&gt; —
      [7] =&gt; ­
      [8] =&gt;  
  )
  Array
  (
      [0] =&gt; ,
      [1] =&gt; '
      [2] =&gt; '
      [3] =&gt; "
      [4] =&gt; "
      [5] =&gt; -
      [6] =&gt; -
      [7] =&gt; -
      [8] =&gt;  
  )
      bad comma â€š
      bad quote â€˜
      bad quote â€™
      bad quote â€œ
      bad quote â€
      bad dash â€“
      bad dash â€”
      bad dash Â­
      bad space   
  
      bad comma â€š
      bad quote â€˜
      bad quote â€™
      bad quote â€œ
      bad quote â€
      bad dash â€"
      bad dash â€"
      bad dash Â-
      bad space   
  </code></pre>