Message9317

Author Arfrever
Recipients Arfrever, amak, fwierzbicki, pekka.klarck, zyasoft
Date 2015-01-06.19:09:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420571342.72.0.465914086051.issue1839@psf.upfronthosting.co.za>
In-reply-to
Content
> Also this problem goes away more or less with Jython 3.

CPython 3 still has sys.getfilesystemencoding() and losslessly (i.e. without REPLACEMENT CHARACTERs) supports bytes paths...

$ rm -fr /tmp/some_dir
$ mkdir /tmp/some_dir
$ touch /tmp/some_dir/ś
$ touch /tmp/some_dir/$'\x80'
$ touch /tmp/some_dir/aaa$'\x80\x81\x82\x83'aaa
$ python3.5 -c 'import os; print(os.listdir(b"/tmp/some_dir"))'
[b'aaa\x80\x81\x82\x83aaa', b'\xc5\x9b', b'\x80']
$ python3.5 -c 'import os; print(os.listdir("/tmp/some_dir"))'
['aaa\udc80\udc81\udc82\udc83aaa', 'ś', '\udc80']
$ LC_ALL="C" python3.5 -c 'import os; print(os.listdir("/tmp/some_dir"))'
['aaa\udc80\udc81\udc82\udc83aaa', '\udcc5\udc9b', '\udc80']
$ python3.5 -c 'import sys; print(sys.getfilesystemencoding())'
utf-8
$ LC_ALL="C" python3.5 -c 'import sys; print(sys.getfilesystemencoding())'
ascii
History
Date User Action Args
2015-01-06 19:09:02Arfreversetmessageid: <1420571342.72.0.465914086051.issue1839@psf.upfronthosting.co.za>
2015-01-06 19:09:02Arfreversetrecipients: + Arfrever, fwierzbicki, amak, pekka.klarck, zyasoft
2015-01-06 19:09:02Arfreverlinkissue1839 messages
2015-01-06 19:09:02Arfrevercreate