Detect character encoding in text files automatically
Python character encoding detector
chardet
$ chardet myfile.txt
$ chardet file1.txt file2.txt file3.txt
$ chardet /path/to/directory/*