summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-11-18 17:45:25 (GMT)
committerGitHub <noreply@github.com>2024-11-18 17:45:25 (GMT)
commitf7ef0203d44acb21ab1c5ff0c3e15f9727862760 (patch)
treeed2d56bf28e690ba1bfb9bd3bf96491b8669722d /Doc
parent8fe1926164932f868e6e907ad72a74c2f2372b07 (diff)
downloadcpython-f7ef0203d44acb21ab1c5ff0c3e15f9727862760.zip
cpython-f7ef0203d44acb21ab1c5ff0c3e15f9727862760.tar.gz
cpython-f7ef0203d44acb21ab1c5ff0c3e15f9727862760.tar.bz2
gh-123803: Support arbitrary code page encodings on Windows (GH-123804)
If the cpXXX encoding is not directly implemented in Python, fall back to use the Windows-specific API codecs.code_page_encode() and codecs.code_page_decode().
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/codecs.rst7
-rw-r--r--Doc/whatsnew/3.14.rst3
2 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index 2cfd8a1..a129a26 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -1042,6 +1042,10 @@ is meant to be exhaustive. Notice that spelling alternatives that only differ in
case or use a hyphen instead of an underscore are also valid aliases; therefore,
e.g. ``'utf-8'`` is a valid alias for the ``'utf_8'`` codec.
+On Windows, ``cpXXX`` codecs are available for all code pages.
+But only codecs listed in the following table are guarantead to exist on
+other platforms.
+
.. impl-detail::
Some common encodings can bypass the codecs lookup machinery to
@@ -1307,6 +1311,9 @@ particular, the following variants typically exist:
.. versionchanged:: 3.8
``cp65001`` is now an alias to ``utf_8``.
+.. versionchanged:: 3.14
+ On Windows, ``cpXXX`` codecs are now available for all code pages.
+
Python Specific Encodings
-------------------------
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 958efbe..8196250 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -194,6 +194,9 @@ Other language changes
They raise an error if the argument is a string.
(Contributed by Serhiy Storchaka in :gh:`84978`.)
+* All Windows code pages are now supported as "cpXXX" codecs on Windows.
+ (Contributed by Serhiy Storchaka in :gh:`123803`.)
+
* :class:`super` objects are now :mod:`pickleable <pickle>` and
:mod:`copyable <copy>`.
(Contributed by Serhiy Storchaka in :gh:`125767`.)