How to convert path to Mac OS X path, the almost-NFD normal form?
Macs normally operate on the HFS+ file system which normalizes paths. That
is, if you save a file with accented ¨¦ in it (u'\xe9') for example, and
then do a os.listdir you will see that the filename got converted to
u'e\u0301'. This is normal unicode NFD normalization that the Python
unicodedata module can handle. Unfortunately HFS+ is not fully consistent
with NFD, meaning some paths will not be normalized, for example ¸£
(u'\ufa1b') will not be changed, although its NFD form is u'\u798f'.
So, how to do the normalization in Python? I would be fine using native
APIs as long as I can call them from Python.
No comments:
Post a Comment