preg replace - PHP removing Non-ASCII characters excluding EUR and GBP signs -
preg replace - PHP removing Non-ASCII characters excluding EUR and GBP signs -
this simple line removes non printable ascii characters:
preg_replace('/[^\x20-\x7e]/', null, $string);
is possible maintain € , £ signs ?
there magic tag currencies: \p{sc}
or \p{currency_symbol}
: currency sign
and have set header utf8
, should utilize /u
modifier unicode support.
header("content-type: text/html;charset=utf-8"); echo preg_replace('/[^\x20-\x7e\p{sc}]/u', null, $string);
php preg-replace
Comments
Post a Comment