GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `locale.windows_locale`: Incorrect Windows locale for Cambodian · Issue #123853 · python/cpython

locale.windows_locale: Incorrect Windows locale for Cambodian #123853

New issue
Copy link
New issue
Copy link
Closed
Closed
locale.windows_locale: Incorrect Windows locale for Cambodian#123853
Copy link
Labels
OS-windowstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@seanbudd
seanbudd
opened on Sep 9, 2024
Issue body actions

Bug report

Bug description:

According to the Windows spec, the locale identifier for Cambodian (0x0453/1107) should be "km-KH"

Sources:

  • https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f
  • https://ss64.com/locale.html

Currently locale.windows_locale[1107] == "kh_KH" incorrectly.
https://github.com/python/cpython/blob/3.12/Lib/locale.py#L1596

It is possible this mistake is from an older version of the protocol, but using the MS reference, the current mapping in Windows has been the case since the earliest recorded spec from 8/8/2013.

If this issue is accepted I am happy to make a small PR to adjust this value.

CPython versions tested on:

3.11, 3.12, 3.13, CPython main branch

Operating systems tested on:

Windows

Linked PRs

  • gh-123853: Corrected Cambodian language locale identifier #123855
  • gh-123853: Update locale.windows_locale #123901
  • gh-123853: Cleanup Windows 95 locale fallback support #144738
  • [3.14] gh-123853: Update locale.windows_locale (GH-123901) #148876
  • [3.13] gh-123853: Update locale.windows_locale (GH-123901) #148877

Activity

Next
  1. seanbudd
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Sep 9, 2024
  2. rruuaanng commented on Sep 9, 2024

    @rruuaanng
    rruuaanng
    on Sep 9, 2024 · Hidden as outdated
    show commentMore actions
  3. seanbudd commented on Sep 9, 2024

    @seanbudd
    seanbudd
    on Sep 9, 2024 · Hidden as outdated
    Author
    show commentMore actions
  4. rruuaanng commented on Sep 9, 2024

    @rruuaanng
    rruuaanng
    on Sep 9, 2024 · Hidden as outdated
    show commentMore actions
  5. seanbudd commented on Sep 9, 2024

    @seanbudd
    seanbudd
    on Sep 9, 2024 · Hidden as outdated
    Author
    show commentMore actions
  6. rruuaanng commented on Sep 9, 2024

    @rruuaanng
    rruuaanng
    on Sep 9, 2024 · Hidden as outdated
    show commentMore actions
  7. seanbudd commented on Sep 9, 2024

    @seanbudd
    seanbudd
    on Sep 9, 2024 · Hidden as outdated
    Author
    show commentMore actions
  8. Eclips4
    added
    OS-windows
    on Sep 9, 2024
  9. rruuaanng commented on Sep 9, 2024

    @rruuaanng
    rruuaanng
    on Sep 9, 2024 · Hidden as outdated
    show commentMore actions
  10. seanbudd commented on Sep 9, 2024

    @seanbudd
    seanbudd
    on Sep 9, 2024
    Author
    More actions

    @rruuaanng - how did you fix it? how did you test it?

  11. Eclips4 commented on Sep 9, 2024

    @Eclips4
    Eclips4
    on Sep 9, 2024
    Member
    More actions

    @rruuaanng If this issue is valid (should be confirmed from locale experts, cc @malemburg), we need to send a PR with a fix, applying changes locally affects only your local git repository.

  12. rruuaanng
    added a commit that references this issue on Sep 9, 2024

    pythongh-123853: fixed the locale identifier for Khmer

    4a0aa52
  13. rruuaanng commented on Sep 9, 2024

    @rruuaanng
    rruuaanng
    on Sep 9, 2024
    Contributor
    More actions

    @rruuaanng - how did you fix it? how did you test it?

    I checked the results of the windows_locale.get(int(code, 0)) statement to see if it gets the corrected value now.

    windows_locale dictionary isn't used anywhere else, so I think fixing the source of the error should be enough.

  14. Eclips4
    added this to Locale issues 🗺on Sep 9, 2024
  15. github-project-automation
    moved this to Todo in Locale issues 🗺on Sep 9, 2024
  16. 17 remaining items

  17. Sadrita404 commented on Jul 29, 2025

    @Sadrita404
    Sadrita404
    on Jul 29, 2025
    More actions

    @@ -1596,7 +1596,8 @@ windows_locale = {
    1088: "tt_RU",
    1090: "uz_UZ",
    1091: "ky_KG",

    • 1107: "kh_KH",
    • Corrected per Microsoft LCID specification:

    • 1107: "km_KH",
      1110: "gl_ES",
      ...
      }

    bpo-XXXX: Corrected Cambodian locale identifier (1107) to "km_KH" in locale.windows_locale

    According to Microsoft's LCID specification, the correct locale code for Cambodian (LCID 1107 / 0x0453) is "km-KH". This patch updates the CPython mapping from the outdated "kh_KH" to "km_KH".

    References:

    • https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f
  18. serhiy-storchaka commented on Jul 29, 2025

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 29, 2025
    Member
    More actions

    cc @malemburg, @zooba

    What should we do with this issue? There is the locale.windows_locale dict that maps Windows codes to locale name. It is incomplete and contains errors. Its purpose is to be used if _locale._getdefaultlocale() returns a hexadecimal code instead of the locale name on Windows, but on modern Windows (after Windows 95?) this never happens, so the dict is not used on practice. _locale._getdefaultlocale() is deprecated anyway.

    So we can:

    • Update windows_locale in accordance to fresh official data. Some names must deviate from the official Windows names for compatibility with Python implementation.
    • Remove windows_locale as it is never used in the stdlib. Remove also some dead code in locale._getdefaultlocale() and _locale._getdefaultlocale(), which are deprecated anyway.
    • We can also just ignore this until the deprecated locale._getdefaultlocale() and _locale._getdefaultlocale() be deleted.
  19. malemburg commented on Jul 29, 2025

    @malemburg
    malemburg
    on Jul 29, 2025
    Member
    More actions

    The removal is scheduled for 3.15 and the dict would normally get removed as part of this, since it would no longer be needed.

    However, people are using it directly and independently from getdefaultlocale(), so perhaps we need start a separate deprecation process for the dict removal.

    Until then, it's a good idea to fix entries where needed.

    Reacted by Steve Dower
  20. seanbudd
    added a commit that references this issue on Jan 19, 2026

    document support for cambodian #19450

    ed543fa
  21. mokurin000 commented on Feb 12, 2026

    @mokurin000
    mokurin000
    on Feb 12, 2026
    Contributor
    More actions

    cc @seanbudd

    As #123853 (comment) mentioned, the windows_locale dict should be considered dead code since Windows 98. You confirmed the bug on Python 3.11 ~ 3.13, is this bug introduced by incorrect language tag returned by Win32 API?

    I am proposing modern Win32 locale API migration, could you test how would that behave for your locale settings?
    You can also test API behavior by this standalone program, it will display return value of different API.

    Note: GlobalizationPreferences: zh-Hans-CN happens because windows actually have two different language settings and the real widely used one is in the control panel region settings.

    Image

    Update: I just found the expression included the windows_locale dictionary directly, which is proven to be dead code since Windows 98.
    This can be however marked as resolved once windows_locale get removed in standard library.

  22. seanbudd commented on Feb 13, 2026

    @seanbudd
    seanbudd
    on Feb 13, 2026
    Author
    More actions

    @mokurin000 - yep, the dictionary just needs to be removed and people need to use LCIDToLocaleName instead

  23. malemburg
    closed this as completedin 171e0faon Feb 27, 2026
  24. github-project-automation
    moved this from Todo to Done in Locale issues 🗺on Feb 27, 2026
  25. pull
    added a commit that references this issue on Feb 27, 2026

    pythongh-123853: Cleanup Windows 95 locale fallback support (python#1…

    171e0fa
  26. brijkapadia
    added a commit that references this issue on Feb 28, 2026

    pythongh-123853: Cleanup Windows 95 locale fallback support (python#1…

    6bedc25
  27. serhiy-storchaka
    added a commit that references this issue on Apr 20, 2026

    gh-123853: Update locale.windows_locale (GH-123901)

    bfe6f9f
  28. ljfp
    added 2 commits that reference this issue on Apr 25, 2026

    pythongh-123853: Cleanup Windows 95 locale fallback support (python#1…

    1127156

    pythongh-123853: Update locale.windows_locale (pythonGH-123901)

    5b8fd52
  29. serhiy-storchaka
    added 2 commits that reference this issue on Jun 8, 2026

    [3.14] gh-123853: Update locale.windows_locale (GH-123901) (GH-148876)

    9e3d9fc

    [3.13] gh-123853: Update locale.windows_locale (GH-123901) (GH-148877)

    cbbddff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Locale issues 🗺
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.