-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty PYTHONIOENCODING is not the same as nonexistent #63018
Comments
$ PYTHONIOENCODING= ./python
Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding:
Aborted (core dumped) As a consequence we can't set only the error handler. $ PYTHONIOENCODING=:surrogateescape ./python
Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding:
Aborted (core dumped) Here is a patch which allows accepting empty encoding as default encoding. |
Patch looks good to me. |
Patch looks good to me, but you have to update Doc/using/cmdline.rst, Tests would also be nice :-) I really like the the "PYTHONIOENCODING=:surrogateescape" use case! |
Second variant of the patch also supports empty error handler as the default error handler (i.e. strict). $ PYTHONIOENCODING=ascii: ./python
Python 3.4.0a1+ (default:5b5ef012cd4e+, Aug 23 2013, 10:18:51)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('\xbd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xbd' in position 0: ordinal not in range(128) Without it different error is raised: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
LookupError: unknown error handler name '' |
Here is a patch with tests and documentation. For the documentation I hope on your help. |
Nick, could you help me with documentation? I'm sure my wording needs improving. And there is one question left. Is this change appropriate for 2.7 and 3.3, or only for 3.4? |
New changeset c7fdb0637d0b by Serhiy Storchaka in branch 'default': |
Thank you Ezio and Vajrasky for the review. |
New changeset 8ac9c3754d33 by R David Murray in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: