On Jan 10, 2020, at 03:45, Inada Naoki <songofaca...@gmail.com> wrote:
> 
> Hi, all.
> 
> I believe UTF-8 should be chosen by default for text encoding.

Correct me if I’m wrong, but I think in Python 3.7 on Windows 10, the 
filesystem encoding is already UTF-8, and the stdio console files are UTF-8 
(but under the covers actually wrap the native UTF-16 console APIs instead of 
using msvcrt stdio), so the only issue is the locale encoding, right?

Also, PYTHONUTF8 is only supported on Unix, so presumably it’s ignored if you 
set it on Windows, right? If so, you need to also add support for it, not just 
set it in the installer. And presumably you also want to add the equivalent 
command-line argument to Windows also 

One last thing: On Linux, you often use the locale coercion feature instead of 
the assume-UTF-8 feature. (For example, if you’re running a subprocess and want 
to ensure its stdout is UTF-8…) Is there an equivalent issue for Windows, or a 
very different but equally important one that needs to be solved differently, 
or is there just nothing relevant here?

> * Windows 10 (1903) adds per-process option to change active code page
> to UTF-8 and call the system code page "legacy".

If you do that, won’t Python 3.7 already use UTF-8 for the locale, because the 
active code page is what it sets the startup value to match? 

> But it is difficult to change the default text encoding of Python
> for backward compatibility.  So I want to recommend the UTF-8 mode:
> 
> * The default text encoding become UTF-8
> * When you need to use legacy ANSI code page, you can
>  use "mbcs" codec.

If you’ve used the Windows 10 feature you mentioned above, won’t this just 
select the same UTF-8 you’re already using?

Or are you suggesting that Python’s mbcs codec should also change to (on 
Windows when UTF8 is enabled) use “legacy” if it exists and only otherwise use 
actual “mbcs”?

Or that nobody should use this Windows feature on Python 3.8+?

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SSB7C5QMG5BRIIYFUNFDCOGAFDG7MOID/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to