Open bodograumann opened 3 years ago
This is due to a change in python codecs handling from version 3.8 to 3.9, where codec names are normalized. Cf. https://bugs.python.org/issue37751
Submitted a new bug report: https://bugs.python.org/issue44723
Another related report: https://bugs.python.org/issue46508
I use this workaround to get it working in case anyone interested:
import codecs
import iconvcodec
import encodings
# Hack alias for resolving https://github.com/bodograumann/python-iconv/issues/4
# as charset names are normalized
def normalized_alias(charset):
codec = 'ASCII//TRANSLIT' # It works also for other codecs that contains normalized characters like '-' or ':'
result = None
if charset == encodings.normalize_encoding(codec.lower()):
result = iconvcodec.lookup(codec)
return result
codecs.register(normalized_alias)
In python 3.9 the
ASCII//TRANSLIT
codec cannot be loaded anymore: