Inada Naoki <songofaca...@gmail.com> added the comment:
> I created this issue while reviewing the implementation of the PEP 597: PR > 19481. What I want is same to `locale.getpreferredencoding(False)` but ignores UTF-8 mode. Background: PEP 597 adds new `encoding="locale"`option to open() and TextIOWrapper(). It is same to `encoding=None` for now, but it means using "locale encoding" explicitly. But this is wrong in UTF-8 mode. In UTF-8 mode, it's fine to `open(filename)` uses UTF-8. But I want to use "locale encoding" for `open(filename, encoding="locale")` because "locale" encoding is specified. I don't want to add new meaning here. It should be same to `locale.getpreferredencoding(False)` without UTF-8 mode. So I need "cp%d" % GetACP() on Windows, not CRT locale encoding. I don't care its name. both of sys.locale_encoding() and locale.get_encoding() are OK. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43552> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com