15 lines
351 B
Python
Executable File
15 lines
351 B
Python
Executable File
import sys
|
|
import glob
|
|
from chardet.universaldetector import UniversalDetector
|
|
|
|
detector = UniversalDetector()
|
|
for filename in sys.argv[1:]:
|
|
#print filename.ljust(60),
|
|
detector.reset()
|
|
for line in file(filename, 'rb'):
|
|
detector.feed(line)
|
|
if detector.done: break
|
|
detector.close()
|
|
print detector.result['encoding']
|
|
|