I have made a module that detects the encoding of a file. I want to be able to able to give file path and encoding as inputs to the class and always be able to get back 'utf-8' when I process the contents of the file.
For example something like this
handler = UnicodeWrapper(file_path, encoding='ISO-8859-2')
for line in handler:
# need the line to be encoded in utf-8
process(line)
I can not understand why there are a million types of encodings yet. But I want to write an interface that always returns unicode.
Is there a library to do this already?