aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-10 03:19:54 +0200
committerGitHub <noreply@github.com>2019-05-10 03:19:54 +0200
commitd267ac20c309e37d85a986b4417aa8ab4d05dabc (patch)
tree701e11585f2a69916429f798895ba6fac1ec0545 /Lib/encodings
parentbpo-32523: Simplifying news entries with multiple paragraphs. (GH-8154) (diff)
downloadcpython-d267ac20c309e37d85a986b4417aa8ab4d05dabc.tar.gz
cpython-d267ac20c309e37d85a986b4417aa8ab4d05dabc.tar.bz2
cpython-d267ac20c309e37d85a986b4417aa8ab4d05dabc.zip
bpo-36778: cp65001 encoding becomes an alias to utf_8 (GH-13230)
Diffstat (limited to 'Lib/encodings')
-rw-r--r--Lib/encodings/aliases.py1
-rw-r--r--Lib/encodings/cp65001.py43
2 files changed, 1 insertions, 43 deletions
diff --git a/Lib/encodings/aliases.py b/Lib/encodings/aliases.py
index 2e63c2f9495..5ef40a3438b 100644
--- a/Lib/encodings/aliases.py
+++ b/Lib/encodings/aliases.py
@@ -534,6 +534,7 @@ aliases = {
'utf8' : 'utf_8',
'utf8_ucs2' : 'utf_8',
'utf8_ucs4' : 'utf_8',
+ 'cp65001' : 'utf_8',
# uu_codec codec
'uu' : 'uu_codec',
diff --git a/Lib/encodings/cp65001.py b/Lib/encodings/cp65001.py
deleted file mode 100644
index 95cb2aecf0c..00000000000
--- a/Lib/encodings/cp65001.py
+++ /dev/null
@@ -1,43 +0,0 @@
-"""
-Code page 65001: Windows UTF-8 (CP_UTF8).
-"""
-
-import codecs
-import functools
-
-if not hasattr(codecs, 'code_page_encode'):
- raise LookupError("cp65001 encoding is only available on Windows")
-
-### Codec APIs
-
-encode = functools.partial(codecs.code_page_encode, 65001)
-_decode = functools.partial(codecs.code_page_decode, 65001)
-
-def decode(input, errors='strict'):
- return codecs.code_page_decode(65001, input, errors, True)
-
-class IncrementalEncoder(codecs.IncrementalEncoder):
- def encode(self, input, final=False):
- return encode(input, self.errors)[0]
-
-class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
- _buffer_decode = _decode
-
-class StreamWriter(codecs.StreamWriter):
- encode = encode
-
-class StreamReader(codecs.StreamReader):
- decode = _decode
-
-### encodings module API
-
-def getregentry():
- return codecs.CodecInfo(
- name='cp65001',
- encode=encode,
- decode=decode,
- incrementalencoder=IncrementalEncoder,
- incrementaldecoder=IncrementalDecoder,
- streamreader=StreamReader,
- streamwriter=StreamWriter,
- )