Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support arbitrary code page encodings on Windows #123803

Closed
Labels
OS-windowsstdlibStandard Library Python modules in the Lib/ directorytopic-unicodetype-featureA feature request or enhancement
@serhiy-storchaka

Description

@serhiy-storchaka

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.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsstdlibStandard Library Python modules in the Lib/ directorytopic-unicodetype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp