I am using chardet library to detect the encoding of files. Code snippet is :
file = open(file_path, \'rb\') detector = UniversalDetector() for line in file: