Message6129

Author pjenvey
Recipients pekka.klarck, pjenvey
Date 2010-10-03.22:05:47
SpamBayes Score 3.4004743e-10
Marked as misclassified No
Message-id <1286143547.89.0.790235275108.issue1658@psf.upfronthosting.co.za>
In-reply-to
Content
This is stat's fault, open creates the file with the correct filename

The underlying stat impl is Windows _stat64 via jnr-posix. The fix for this might be to use _wstat64 instead. Though CPython apparently uses a different API call for win32 stat: GetFileAttributesExW

Another solution might be to support sys.getfilesystemencoding and encode the filename first, but the JVM doesn't even seem to support the 'mbcs' encoding?? (correct me if I'm wrong)

Jython's os.listdir with a str arg also differs from what CPython returns for this file. I guess this should be expected since Jython lacks a sys.getfilesystemencoding() value on Windows

We return:

>>> os.listdir('.')
['\xfe.txt', '\u0100.txt', '\xff.txt']
>>> os.listdir(u'.')
[u'\xfe.txt', u'\u0100.txt', u'\xff.txt']

CPython 2.5:
>>> os.listdir('.')
['\xfe.txt', 'A.txt', '\xff.txt']
>>> os.listdir(u'.')
[u'\xfe.txt', u'\u0100.txt', u'\xff.txt']

You get 'A.txt' from '\u100.txt'.encode('mbcs') ('mbcs' being sys.getfilesystemencoding())
History
Date User Action Args
2010-10-03 22:05:47pjenveysetmessageid: <1286143547.89.0.790235275108.issue1658@psf.upfronthosting.co.za>
2010-10-03 22:05:47pjenveysetrecipients: + pjenvey, pekka.klarck
2010-10-03 22:05:47pjenveylinkissue1658 messages
2010-10-03 22:05:47pjenveycreate