Index: Lib/encodings/__init__.py =================================================================== --- Lib/encodings/__init__.py (revision 55807) +++ Lib/encodings/__init__.py (working copy) @@ -60,11 +60,8 @@ """ # Make sure we have an 8-bit string, because .translate() works # differently for Unicode strings. - if isinstance(encoding, str): - # Note that .encode('latin-1') does *not* use the codec - # registry, so this call doesn't recurse. (See unicodeobject.c - # PyUnicode_AsEncodedString() for details) - encoding = encoding.encode('latin-1') + if not isinstance(encoding, str8): + encoding = str8(encoding) return '_'.join(encoding.translate(_norm_encoding_map).split()) def search_function(encoding):