Hi, all.

I believe UTF-8 should be chosen by default for text encoding.

* The default encoding for Python source file is UTF-8.
* VS Code and even notepad uses UTF-8 by default.
* Text files downloaded from the Internet is probably UTF-8.
* UTF-8 is used when you use WSL regardless your system code page.
* Windows 10 (1903) adds per-process option to change active code page
to UTF-8 and call the system code page "legacy". [1]

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.
* You can disable it when you need to run Python application
  relying on the legacy system encoding.

But it is not well known yet.  And setting the environment variable
is a bit difficult for people who are learning programming with Python.

So I want to propose this:

1. Recommend it in the official document "Using Python on Windows" [2].
2. Show the UTF-8 mode status in the command line mode header [3] on Windows.
3. Show the link to the UTF-8 mode document in the command line mode header too.
4. Add checkbox to set "PYTHONUTF8=1" environment variable in the installer.

How do you think?

If setting "PYTHONUTF8=1" environment variable is too danger
to recommend widely, we may be able to add per-installation
(and per-venv if needed) option file (site.cfg in the directory same to
python.exe) to enable UTF-8 mode.
But it may make Python startup process more complex...

Regards,

[1]: 
https://docs.microsoft.com/en-us/windows/uwp/design/globalizing/use-utf8-code-page
[2]: https://docs.python.org/3/using/windows.html
[3]: Currently, Python version and "Type "help",..." are printed.

--
Inada Naoki  <songofaca...@gmail.com>
_______________________________________________
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/524JQFZ4RMRLU7DBPSQDR735Z2UMSWQG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to