title: Check for valid utf8 string in Python
body: <p>I'm reading filenames from file system and I want to send them as JSON encoded array. The problem is that files on file system can be stored in invalid encoding, and I need to handle this situation to omit invalid filenames before passing it to <code>json.dump</code>, otherwise it will fail.</p>
  
  <p>Is there a way to check that my string (filename) contains valid utf-8 chars?</p>