This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ezio.melotti, vstinner
Date 2017-01-11.11:27:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484134042.51.0.347511837763.issue29240@psf.upfronthosting.co.za>
In-reply-to
Content
pep540.patch: first draft

Changes:

* Add sys.flags.utf8mode
* Add -X utf8 command line option
* Add PYTHONUTF8 environment variable
* sys.stdin, sys.stdout and sys.stderr encoding and errors are modified in UTF-8 mode
* open() default encoding and errors is modified in the UTF-8 mode
* Add Lib/test/test_utf8mode.py
* Skip a few tests relying on the locale encoding if the UTF-8 mode is enabled
* Document changes

Allowed options:

* Disable UTF-8 mode: -X utf8=0 or PYTHONUTF8=0
* Enable UTF-8 mode: -X utf8=1 or PYTHONUTF8=1
* Enable UTf-8 Strict mode: -X utf8=strict or PYTHONUTF8=strict
* Other -X utf8 and PYTHONUTF8 values cause a fatal error

Prioririties (highest to lowest):

* open() encoding and errors arguments
* PYTHONIOENCODING
* UTF-8 mode
* os.device_encoding()
* locale encoding

TODO:

* re-encode sys.argv from the local encoding to UTF-8 in Py_Main() when the UTF-8 mode is enabled
* support strict mode in Py_DecodeLocale() and Py_EncodeLocale()
History
Date User Action Args
2017-01-11 11:27:24vstinnersetrecipients: + vstinner, ezio.melotti
2017-01-11 11:27:22vstinnersetmessageid: <1484134042.51.0.347511837763.issue29240@psf.upfronthosting.co.za>
2017-01-11 11:27:22vstinnerlinkissue29240 messages
2017-01-11 11:27:22vstinnercreate