Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Description
Feature or enhancement
Python supports encodings that correspond to some code pages on Windows, like cp437 or cp1252. But every such encoding should be specially implemented. There are code pages that do not have corresponding codec implemented in Python.
But there are functions that allow to encode or decode using arbitrary code page:codecs.code_page_encode() andcodecs.code_page_decode(). The only step left is to make them available as encodings, so they could be used instr.encode() andbytes.decode().
Currently this is already used for the current Windows (ANSI) code page. If the cpXXX encoding is not implemented in Python and XXX matches the value returned byGetACP(), "cpXXX" will be made an alias to the "mbcs" codec.
I propose to add support for arbitrary cpXXX encodings on Windows. If such encoding is not implemented directly, fall back to use the Windows-specific API.