PHP - Can't remove strange character
<p>I'd really appreciate some help with this. I've wasted days on this problem and none of the suggestions I have found online seem to give me a fix.</p>

<p>I have a CSV file from a supplier. It appears to have been exported from an Microsoft system.</p>

<p>I'm using PHP to import the data into MySQL (both latest versions). </p>

<p>I have one particular record which contains a strange character that I can't get rid of. Manual editing to remove the character is possible, but I would prefer an automated solution as this will happen multiple times a day.</p>

<p>The character appears to be an interpretation of a “smart quote”. A hex editor tells me that the character codes are C2 and 92. In the hex editor it looks like a weird A followed by a smart quote. In other editors and Calc, Writer etc it just appears as a box. ﾒ</p>

<p>I'm using mb_detect_encoding to determine the encoding. All records in the CSV file are returned as ASCII, except the one with the strange character, which is returned as UTF-8.
I can insert the offending record into MySQL and it just appears in Workbench as a square.</p>

<p>MySQL tables are configured to <code>utf-8 – utf8_unicode_ci</code> and other unusual UTF characters (eg fractions) are ok.</p>

<p>I've tried lots of solutions to this...</p>

<ul>
<li><a href="http://stackoverflow.com/questions/6723562/how-to-detect-malformed-utf-8-string-in-php">How to detect malformed utf-8 string in PHP?</a></li>
<li><a href="http://stackoverflow.com/questions/1401317/remove-non-utf8-characters-from-string">Remove non-utf8 characters from string</a></li>
<li><a href="http://stackoverflow.com/questions/9631299/removing-invalid-incomplete-multibyte-characters">Removing invalid/incomplete multibyte characters</a></li>
<li><a href="http://stackoverflow.com/questions/6723562/how-to-detect-malformed-utf-8-string-in-php">How to detect malformed utf-8 string in PHP?</a></li>
<li><a href="http://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php">How to replace Microsoft-encoded quotes in PHP</a></li>
</ul>

<p>etc etc but none of them have worked for me.</p>

<p>All I really want to do is remove or replace the offending character, ideally with a search and replace for the hex values but none of the examples I have tried have worked.</p>

<p>Can anyone help me move forward with this one please?</p>

<p><strong>EDIT</strong>:<br>
Can't post answer as not enough reputation:<br>
Thanks for your input. Much appreciated.<br>
I'm just going to go with the hex search and replace:</p>

<pre><code>$DodgyText = preg_replace("/\xEF\xBE\x92/", "" ,$DodgyText);
</code></pre>

<p>I know it's not the elegant solution, but I need a quick fix and this works for me.</p>
