[Python-Dev] Import and unicode: part two

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Jan 25 16:00:11 CET 2011


On 09:22 am, catch-all at masklinn.net wrote:
>On 2011-01-25, at 04:26 , Toshio Kuratomi wrote:
>>
>>* If you can pick a set of encodings that are valid (utf-8 for Linux 
>>and
>>  MacOS
>
>HFS+ uses UTF-16 in NFD (actually in an Apple-specific variant of NFD). 
>Right here you've already broken Python modules on OSX.

Are you sure about the UTF-16 part?  Evidence strongly points towards 
UTF-8:

  $ python
  Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)  [GCC 4.2.1 (Apple 
Inc. build 5646)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import unicodedata, os
  >>> file(u'\N{SNOWMAN}', 'w').close()
  >>> os.listdir('.')
  ['\xe2\x98\x83']
  >>> unicodedata.name('\xe2\x98\x83'.decode('utf-8'))
  'SNOWMAN'
  >>>
Jean-Paul


More information about the Python-Dev mailing list