I copy & paste match lists from Betfair but they have dodgy hidden characters equivalent to "Â". This means that rather than "Arsenal v Reading - Tuesday 19:45" I get "Arsenal v Reading - Tuesday 19:45".
To try and address this I do the following:
$pos = strrpos($match,"Â");
echo "pre-replace: " . $pos . "<br/>";
$trim_match = str_replace("Â","",$match);
$pos = strrpos($trim_match,"Â");
echo "post-replace: " . $pos . "<br/>";
$q2 = "insert into tab (`match`) values ('" . trim($trim_match) . "')";
The resulting output is:
pre-replace: 23
post-replace:
But the dodgy character is still inserted. What's the best way to keep this junk data out? It is not visible when UTF-8 is set in the page or in PHPMyAdmin but the hex('l v') of the bad data is "6CC2A076" which equates to a "Â" symbol according to ASCII converters