Created
April 29, 2014 09:39
-
-
Save mitsuhiko/11395418 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mitsuhiko at atherton in /tmp/test | |
$ python3 | |
Python 3.4.0 (v3.4.0:04f714765c13, Apr 15 2014, 15:41:42) | |
[GCC 4.2.1 Compatible Clang 3.2 (tags/RELEASE_32/final)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import os | |
>>> letter = '\xf6' | |
>>> letter | |
'ö' | |
>>> open(letter, 'w').close() | |
>>> os.listdir('.')[0] | |
'ö' | |
>>> os.listdir('.')[0] == letter | |
False |
working on ubuntu trusty with Python 3.4.0 (default, Apr 11 2014, 13:05:11)
, but i guess the whole point was, that python is not consistent on different platforms/distributions?
This is OS X’s filesystem doing Unicode normalization.
This has always been buggy code – OS X normalizes to NFD, Linux is usually NFC and Windows does neither (“the file system treats path and file names as an opaque sequence of WCHARs” – http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx).
it works on Arch with
Python 3.4.0 (default, Mar 17 2014, 23:20:09)
[GCC 4.8.2 20140206 (prerelease)] on linux
cat /etc/locale.conf
LANG=en_US.UTF-8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works for me.
That's RHEL-7 (package from Fedora 21)