On 15 Jun 2011, at 21:13, Trevyn Meyer wrote:
> $value = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $value);
I don't want to remove them; I want to replace them with their ascii
counterparts.
I had tried something like the following previous and it wasn't working—it is
now however:
$bad = array('”', '“', "’", "’", "…", "—", "–");
$good = array('"', '"', "'", "'", '…', '—', '—');
$string = str_replace($bad, $good, $string);
Other solutions I have seen where the bad chars are codes seems better though
as it doesn't rely on the script being the right encoding (as evidenced by them
probably not making it through correctly in this email).
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net