I have a string that has an apostrophe character that can't be escaped or searched for.
Essentially I have a string that is being pulled from a 3rd party service. It is encoded as ISO-8859-1 and when it comes in, I can't escape a particular character. A sample string is below
We’re proud to offer some exciting products that come with a full manufacturer's warranty
In this case, using mysql_real_escape_string won't escape the first apostrophe, but it will escape the others. No matter what I do, I can't seem to escape the string or replace it with a normal apostrophe.
Here is what I use to acquire the file.
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Content-Type: text/html; charset=ISO-8859-1"
)
);
$context = stream_context_create($opts);
$html = file_get_contents($url, false, $context);
If I try an convert the string to UTF-8 using mb_convert_encoding(), it doesn't alter it in any way. I tried to simply replace the string using str_ireplace() on the ISO-8859-1 string and mb_ereg_replace on the UTF-8 string. Nothing has any effect.