$a='some string that you want to clean'; #remove all non utf8 characters $a = mb_convert_encoding($a, 'UTF-8', 'UTF-8'); # Remove non printable character (i.e. below ascii code 32). $a = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/u', '', $a);
I hope that I saved someones time (thanks Gregor for help).
No comments:
Post a Comment