I\'ve got about 1000 filenames read by os.listdir(), some of them are encoded in UTF8 and some are CP1252.
os.listdir()
I want to decode all of them to Unicode for f
Use chardet library. It is super easy
import chardet the_encoding = chardet.detect('your string')['encoding']
and that's it!