This is a quick and dirty script inspired by this post, but it can definitely be a useful tool:
#!/usr/bin/env python from chardet import detect from sys import argv for fn in argv[1:]: with open(fn, "rb") as f: print(fn, detect(f.read())['encoding'])