Message5678

Author pekka.klarck
Recipients pekka.klarck
Date 2010-04-12.07:07:34
SpamBayes Score 2.7594038e-10
Marked as misclassified No
Message-id <1271056056.55.0.0699845750629.issue1593@psf.upfronthosting.co.za>
In-reply-to
Content
If directory listing is taken using str name, Jython 2.5.1 returns different str names than Python 2.6 on Ubuntu:

$ mkdir x
$ touch x/tyhjä
$ python -c "import os; print os.listdir('x')" 
['tyhj\xc3\xa4']
$ jython -c "import os; print os.listdir('x')" 
['tyhj\xe4']

Based on the results the underlying problem seems to be the same as in issue 1592. It can be argued that this is fine, but the behavior when os.listdir is used with Unicode name is definitely a bug:

$ python -c "import os; print os.listdir(u'x')"
[u'tyhj\xe4']
$ jython -c "import os; print os.listdir(u'x')"
['tyhj\xe4']

From the doc of os.listdir: """If path is a Unicode object, the result will be a list of Unicode objects. Undecodable filenames will still be returned as string objects."""
History
Date User Action Args
2010-04-12 07:07:36pekka.klarcksetrecipients: + pekka.klarck
2010-04-12 07:07:36pekka.klarcksetmessageid: <1271056056.55.0.0699845750629.issue1593@psf.upfronthosting.co.za>
2010-04-12 07:07:36pekka.klarcklinkissue1593 messages
2010-04-12 07:07:35pekka.klarckcreate