12. 2012-10-18 from Mick
• Actually, Jamie and I have spent the afternoon
investigating this further, and we have found the
exact issue and come up with a solution. I shall
commit the fix tomorrow.
• in short, there is a rather bad bug in Python's
tempfile.gettempdir when dealing with multi-byte
filenames.
• I was able to reproduce your issue exactly.
13. Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from os.path import normcase
>>> p = ur'C:DOCUME~1川山'
>>> print p
C:DOCUME~1川山
>>> print normcase(p.encode('cp932')).decode('cp932')
c:docume~1川屍
>>> print ["0x%02x %s" % (ord(c), c) for c in u'山'.encode('cp932')]
['0x8e x8e', '0x52 R']
>>> print ["0x%02x %s" % (ord(c), c) for c in normcase(u'山'.encode('cp932'))]
['0x8e x8e', '0x72 r']