I\'ve already wasted a good amount of time dealing with strings (generated by some other source) and I found out that the problem was that the strings have non-printable cha
Best practice seems to dictate that you specify what you WILL accept (the white-list approach), rather than trying to filter out what you WON'T accept (the black-list approach).
This is a similar question, although the answers are not comprehensive.