Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to delete characters which can not be printable

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 302
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: