[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-29 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: For completeness sake: Apple's Cocoa APIs do not renormalize strings, that is: I've created a file named 'één' in the Terminal, then (using a python 3.2 build): # Terminal input seems NFC: len('één') 3 # Output from os.listdir isn't:

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: I'd like to see this patch reverted. I don't think it is useful. 1. encoding with NFD should not be necessary, as the system will do that, anyway. 2. decoding with NFC is incompatible with previous Python releases, and I can't see why NFC

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I'd like to see this patch reverted. I created a specific branch to test the patch (I also patched PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize()): issue10209. test_pep277 now pass in this branch! encoding

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Some pointers. MacFUSE http://code.google.com/p/macfuse/issues/detail?id=139#c2 FILENAME_ENCODING_PROPOSAL (MacFUSE) http://code.google.com/p/macfuse/wiki/FILENAME_ENCODING_PROPOSAL Converting to Precomposed Unicode

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Yes, but not exactly... Mac OS X NFD normalization is a little bit different than Python's normalization: see msg105669 and http://developer.apple.com/library/mac/#qa/qa2001/qa1173.html I see. This is one more reason not to convert

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: My question is rather why it failed in the first place, when issue8207 had supposedly fixed it. r79426 (of #8207) only disabled some tests. The problem with test_normalize() and test_listdir() of test_pep277 is maybe that these

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The problem with test_normalize() and test_listdir() of test_pep277 is maybe that these tests are irrevelant on Mac OS X? I tried a different approach (different than my patch and the svn branch): - r85897 disables the filenames

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: - r85897 disables the filenames that are normalized differently by Python and by darwin - r85899 disables test_normalize and test_listdir tests It looks like r85897 is enough to fix test_pep277 on x86 Tiger 3.x buildbot. But

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I now agree with Martin: Mac OS X: Decompose filenames on encode, and precompose filenames on decode was a bad idea, fix the test is the right solution. test_pep277 now pass on x86 Tiger 3.x buildbot, and so I can close this

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-28 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10209 ___

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-26 Thread STINNER Victor
New submission from STINNER Victor victor.stin...@haypocalc.com: PyUnicode_EncodeFSDefault() and os.fsencode() should decompose the filename (NFD) before encoding it to utf-8. PyUnicode_DecodeFSDefault(AndSize)() and os.fsdecode() should precompose the filename (NFC) after decoding it from

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-26 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Patch for os.fsencode/fsdecode importing unicodedata in the function (instead of a global import). unicodedata module is not builtin and is dynamically loaded. We should maybe ignore ImportError if the module is not available? With