Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- problems with ctype_print
May 23, 2006, 6:09 pm
rate this thread
Re: problems with ctype_print
Ok, if preg_match( '/[^\s\w]/', "teststring" ) returns true then
non-printable characters were found
But it may not work because the manual suggest the \w in preg_match is
limited by the charset and locale settings as well.
If it doesn't work then try ini_set('default_charset',"UTF-8") or put
default_charset=UTF-8 in your php.ini
setlocale() won't really help, it might make a few more characters pass
the ctype_print test but not all of them.
Another option is $okChars = preg_replace_all( /[^\s\w]/, '',
"teststring" ) to remove any chars which aren't whitespace or a word
character from the test string and $okString is left with what preg
recognised as ok.