I have a collection of files encoded in ANSI or UTF-16LE. I would like python to open the files using the correct encoding. The problem is that the ANSI files do not raise any sort of exception when encoded using UTF-16le and vice versa.
Is there a straightforward way to open up the files using the correct file encoding?
Use the chardet library to detect the encoding.