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

STINNER Victor report at bugs.python.org
Thu May 9 21:23:50 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

About the ANSI code page, Lib/encodings/__init__.py calls _winapi.GetACP() to avoid relying on locale.getpreferredencoding() which lies when UTF-8 Mode is enabled:

            import _winapi
            ansi_code_page = "cp%s" % _winapi.GetACP()
            if encoding == ansi_code_page:
                import encodings.mbcs
                return encodings.mbcs.getregentry()

INADA-san:
> So I don't think it is lie.  It is just "what encoding name we should choose when GetACP() returned 65001.".
> With your PR 13230, cp65001 is truly utf-8.  So returning "utf-8" seems right behavior.

Well, feel free to propose a PR. I have no strong opinion on this level of detail :-)

----------

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


More information about the Python-bugs-list mailing list