Skip to content

Instantly share code, notes, and snippets.

@tmaybe
Created February 11, 2014 21:41
Show Gist options
  • Save tmaybe/8944790 to your computer and use it in GitHub Desktop.
Save tmaybe/8944790 to your computer and use it in GitHub Desktop.
Check a file for non-UTF-8 characters
import re
with open("calon-dprd_diy.csv", 'rU') as f:
for line in f:
if re.search(r'[\x80-\xFF]', line):
print 'bad string in line ' + line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment