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 Sworddragon, docs@python, vstinner
Date 2013-12-02.12:34:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385987658.05.0.749644891742.issue19847@psf.upfronthosting.co.za>
In-reply-to
Content
"It is nice that you could fixed the documentation due to this report but this was just a sideeffect - so closing this report and moving it to "Documentation" was maybe wrong."

Oh sorry, I read the issue too quickly, I stopped at the first sentence. I reopen the issue the reply to the other points.


"In my opinion relying on the locale environment is risky since filesystem-encoding != locale. This is especially the case if working on a filesystem from an external media like an external hard disk drive. Operating on multiple media can also result in different filesystem-encodings."

This issue is not specific to Python. If you mount an USB key formated in VFAT with the wrong encoding on Linux, you will get mojibake in your file explorer. Same issue if you connect a network share (ex: NFS) using a different encoding than the server. You can find many other examples (hint: Mac OS X and Unicode normalization).

There is no good compromise here. The only two safe options are:

(A) convert filenames of your filesystem to the same encoding than your computer (there are tools for that, like convmv)

(B) use raw bytes instead of Unicode, Python 3 should accept bytes anywhere that OS data is expected (filenames, command line arguments, environment variables)

All operating systems (except Windows) are now using UTF-8 by default for the locale encoding. So slowly, mojibake issues on filename should become very rare.


"It would be useful if the user can make his own checks and change the default filesystem-encoding if needed."

This idea was already proposed in issue #8622, but it was a big fail. Please read my following email for more information:
https://mail.python.org/pipermail/python-dev/2010-October/104509.html
History
Date User Action Args
2013-12-02 12:34:18vstinnersetrecipients: + vstinner, docs@python, Sworddragon
2013-12-02 12:34:18vstinnersetmessageid: <1385987658.05.0.749644891742.issue19847@psf.upfronthosting.co.za>
2013-12-02 12:34:18vstinnerlinkissue19847 messages
2013-12-02 12:34:17vstinnercreate