mirror of
https://github.com/python/cpython.git
synced 2025-10-13 10:23:28 +00:00
Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup
This commit is contained in:
parent
22d0698d3b
commit
f5aba58480
8 changed files with 198 additions and 51 deletions
16
Lib/site.py
16
Lib/site.py
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue