title: PHP: How to encode U+FFFD in order to do a replace?
body: <p>I'm trying to display a data feed on a page. We're experiencing encoding issues with a weird character. For some reason, in the feed there's the <code>U+FFFD</code> character. And <code>htmlentities()</code> will not escape the character, so I need to replace it manually. (I'm using PHP 5.3)</p>
  
  <p>I've tried the following:</p>
  
  <pre><code>$string = str_replace( "\xFFFD",  "_", $string );
  $string = str_replace( "\XFFFD",  "_", $string );
  $string = str_replace( "\uFFFD",  "_", $string );
  $string = str_replace("\x{FFFD}", "_", $string );
  $string = str_replace("\X{FFFD}", "_", $string );
  $string = str_replace("\P{FFFD}", "_", $string );
  $string = str_replace("\p{FFFD}", "_", $string );
  </code></pre>
  
  <p>None of the above work.</p>
  
  <p>After reading this page - <a href="http://php.net/manual/en/regexp.reference.unicode.php">http://php.net/manual/en/regexp.reference.unicode.php</a> - I'm not sure what I'm doing wrong. Do I need to compile UTF-8 support into PCRE?</p>