Issue1593

classification
Title: os.listdir doesn't work correctly when directory contains non-ASCII items
Type: Severity: normal
Components: Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: pekka.klarck, pjenvey
Priority: Keywords:

Created on 2010-04-12.07:07:36 by pekka.klarck, last changed 2010-04-13.04:09:51 by pjenvey.

Messages
msg5678 (view) Author: Pekka Klärck (pekka.klarck) Date: 2010-04-12.07:07:34
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."""
msg5689 (view) Author: Philip Jenvey (pjenvey) Date: 2010-04-13.04:09:51
Right, we can't really do anything about the first issue like #1592. The second issue was just recently fixed, it's a dupe of #1520
History
Date User Action Args
2010-04-13 04:09:51pjenveysetstatus: open -> closed
resolution: duplicate
messages: + msg5689
nosy: + pjenvey
2010-04-12 07:07:36pekka.klarckcreate