[Python-Dev] Filename as byte string in python 2.6 or 3.0?

Jack Jansen Jack.Jansen at cwi.nl
Mon Sep 29 14:24:11 CEST 2008

I'm a bit late to join in this discussion, but if unicode filenames  
are going to be the normal mode, how about this whole normalized/ 
canonical business?

This is a headache that has shown up on the Mac a couple of times,  
because MacOS prefers filenames to be NFC, whereas Python prefers its  
Unicode to be NFD (or the other way around, I keep forgetting the  

To make the problem worse, even though MacOS prefers its filenames in  
the one form, it will allow filenames in the other form (which can  
happen if you mount a foreign filesystem, for example over the net).  
The fact that "incorrect" filenames can exist mean that the simple  
solution of converting NFC<->NFD in Python's open() and friends won't  
work (or, at least, it'll make some filenames inaccessible, and  
listdir() may return filenames that don't exist).

Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  

More information about the Python-Dev mailing list