Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup

This commit is contained in:
Steve Dower 2016-09-06 19:42:27 -07:00
parent 22d0698d3b
commit f5aba58480
8 changed files with 198 additions and 51 deletions

View file

@ -423,21 +423,6 @@ def enablerlcompleter():
sys.__interactivehook__ = register_readline
def aliasmbcs():
"""On Windows, some default encodings are not provided by Python,
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case."""
if sys.platform == 'win32':
import _bootlocale, codecs
enc = _bootlocale.getpreferredencoding(False)
if enc.startswith('cp'): # "cp***" ?
try:
codecs.lookup(enc)
except LookupError:
import encodings
encodings._cache[enc] = encodings._unknown
encodings.aliases.aliases[enc] = 'mbcs'
CONFIG_LINE = r'^(?P<key>(\w|[-_])+)\s*=\s*(?P<value>.*)\s*$'
def venv(known_paths):
@ -560,7 +545,6 @@ def main():
setcopyright()
sethelper()
enablerlcompleter()
aliasmbcs()
execsitecustomize()
if ENABLE_USER_SITE:
execusercustomize()