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 Arfrever, amaury.forgeotdarc, lemburg, vstinner
Date 2010-09-24.11:52:57
SpamBayes Score 1.6653345e-16
Marked as misclassified No
Message-id <>
> Why is this needed ?

Short answer: to support filesystem encoding different than utf-8. See #8611 for a longer explanation.


$ pwd
$ PYTHONFSENCODING=ascii ./python 
Fatal Python error: Py_Initialize: can't initialize sys standard streams
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 20: ordinal not in range(128)

My patch fixes this specific case and prepare the work for the complete fix (support different *locale* encodings, see #8611 and #9425).


Longer answer: Py_FilesystemDefaultEncoding is changed too late. Some modules are already loaded, sys.executable is already set, etc. Py_FilesystemDefaultEncoding is changed but modules filenames are decoded with utf-8 and should be "redecoded".

It is not possible to set Py_FilesystemDefaultEncoding before loading the first module. initfsencoding() loads codecs and encodings modules to check the codec name. sys.executable is also set before initfsencoding().

Read my other messages of this issue to get other reasons why the patch is needed. I explained other possibilities (but they don't work).
Date User Action Args
2010-09-24 11:53:00vstinnersetrecipients: + vstinner, lemburg, amaury.forgeotdarc, Arfrever
2010-09-24 11:52:59vstinnersetmessageid: <>
2010-09-24 11:52:58vstinnerlinkissue9630 messages
2010-09-24 11:52:57vstinnercreate