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 strings into NFD, no? > I don't understand why test_pep277 pass on issue10209 branch, but it > works. I suppose that normalize the filename to NFD in Python avoids > some Mac OS X normalization bugs? My question is rather why it failed in the first place, when issue8207 had supposedly fixed it. > I propose to normalize to NFC because Qt does that. Hmm. I find that a weak argument - in particular given that the system will normalize then in turn anyway, and to a slightly different normalform. So what is Qt's motivation to normalize? > On Linux, the keyboard uses NFC. I think this is technically incorrect. When you press é, then some scan code is generated. That goes through various mapping layers. The outcome will depend on how specifically these layers are configured. > Which norm is used on Mac OS X, eg. for the keyboard? Same reasoning: pressing a key initially does not generate any Unicode at all. My guess is that when eventually a character is generated (e.g. on the terminal), no normal form is used; instead, it most likely will always strive to generate a single character (even if that is not normalized). See http://developer.apple.com/library/mac/#qa/qa2001/qa1235.html which says "Macintosh keyboards generally produce precomposed Unicode" > Anyway, I think that os.fsencode(os.fsdecode(name)) should be equal > to name. I agree. and that is currently already the case. > If it's different, "open(name, 'w').close(); name in > listdir()" is False (on systems storing filenames as bytes). So if > you change fsdecode(), fsencode() should also be changed. I'm saying that fsdecode shouldn't change, either, the primary reason being backwards compatibility here. ---------- title: Mac OS X: Decompose filenames on encode, and precompose filenames on decode -> Mac OS X: Decompose filenames on encode, and precompose filenames on decode _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10209> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com