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, loewis, mvo, pitrou, vstinner
Date 2012-10-08.15:46:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwbQG+VQCW-J7OQ1N3nPRGniTDei6jBsCUC+QGp7sUL-UA@mail.gmail.com>
In-reply-to <1349709047.85.0.0352630701705.issue16162@psf.upfronthosting.co.za>
Content
> I think that Py_FileSystemDefaultEncoding should get updated when locale.setlocale() is run automatically

This is not a good idea. The two following expressions must be True on UNIX:
os.fsencode(os.fsdecode(name)) == name
os.fsdecode(os.fsencode(name)) == name

Said differently: if you change the filesystem encoding, you cannot
encode or decode (depending on the type, str or bytes) back the
filename.

For example, sys.path is a list of filenames filled in an early stage
of Python initialization. If you change the filesystem encoding after
this list is filled, you may fail to import modules.

See also this thread:
http://mail.python.org/pipermail/python-dev/2010-October/104509.html

--

If you want to change the locale encoding, please do it outside Python
(before running Python), and then don't change it again! Example on
Ubuntu:

$ LC_CTYPE=fr_FR.iso885915@euro python -c 'import sys;
print(sys.getfilesystemencoding())'
ISO-8859-15
History
Date User Action Args
2012-10-08 15:46:36vstinnersetrecipients: + vstinner, loewis, pitrou, mvo, ezio.melotti
2012-10-08 15:46:36vstinnerlinkissue16162 messages
2012-10-08 15:46:36vstinnercreate