[issue14255] tempfile.gettempdir() didn't return the path with correct case.

James Teh report at bugs.python.org
Fri Oct 19 04:27:57 CEST 2012


James Teh added the comment:

This issue is much nastier than it seems when dealing with character sets that contain multi-byte characters in Python 2.7 on Windows. For example, on a Japanese system:
1. The ANSI code page is cp932 and Python 2.7 will return the TEMP environment variable as a str with this encoding.
2. If a user has a username containing the character \u5c71, this will be encoded as \x8eR, so the TEMP environment variable will include this character.
3. When normcase is called, \x8eR is converted to \x8er.
4. Because \x8eR is a multi-byte character, \x8er is an unrelated character; case insensitivity for "R" doesn't apply.
5. The result is that the correct temp directory is skipped. In fact, on most systems, IOError is raised because none of the other candidate directories are valid either.

----------
nosy: +jteh

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14255>
_______________________________________


More information about the Python-bugs-list mailing list