Hello Reader's if your page is generating some non readable characters that are not able to print then by using PHP you can remove them as follows:-
Many of the other answers here do not take into account unicode characters (e.g. ). In this case you can use the following:
$string = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\x9F]/u', '', $string);
If you also wish to strip line feeds, carriage returns, and tabs you can use:
$string = preg_replace('/[\x00-\x1F\x80-\x9F]/u', '', $string);
If you wish to strip everything except basic printable ASCII characters (all the example characters above will be stripped) you can use:
$string = preg_replace( '/[^[:print:]]/', '',$string);
0 Comment(s)