diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index b928976131f..b2542b8bd74 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -69,7 +69,9 @@ def search_function(encoding): globals(), locals(), _import_tail) except ImportError: import aliases - modname = aliases.aliases.get(modname, modname) + modname = (aliases.aliases.get(modname) or + aliases.aliases.get(modname.replace('.', '_')) or + modname) try: mod = __import__(modname, globals(), locals(), _import_tail) except ImportError: