[issue36778] test_site.StartupImportTests.test_startup_imports fails if default code page is cp65001

Eryk Sun report at bugs.python.org
Thu May 9 19:34:07 EDT 2019


Eryk Sun <eryksun at gmail.com> added the comment:

> I dislike lying in the locale module. This change is basically useless 
> with my PR 13230.

Yes, functionally it's no different than using 'cp65001' as an alias. That said, the CRT special cases 65001 as "utf8":

    >>> locale.setlocale(locale.LC_CTYPE, '')
    'English_United Kingdom.utf8'
    >>> crt_locale = ctypes.CDLL('api-ms-win-crt-locale-l1-1-0', use_errno=True)
    >>> crt_locale.___lc_codepage_func()
    65001

So the suggested change makes the locale module internally consistent on Windows and more transparent for anyone who doesn't know off the top of their head that "cp65001" is just UTF-8.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36778>
_______________________________________


More information about the Python-bugs-list mailing list