Problems with Unicode Plane 1 characters on Windows
Fredrik Lundh
fredrik at pythonware.com
Wed Jul 12 11:00:07 EDT 2006
Edin Salković wrote:
> Why doesn't the following code work on Windows XP, although it works
> on Linux (Ubuntu 6.06). Both versions are of Python are 2.4, and both
> OSs are on the same PC.
>
>>>> import unicodedata
>>>> unicodedata.name(U'\U0001d400')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: need a single Unicode character as parameter
>
> The output should say:
> MATHEMATICAL BOLD CAPITAL A
hint:
>>> len(u'\U0001d400')
2
Python's Unicode system uses 16-bit values internally on some platforms,
and 32-bit values on some platforms. on 16-bit platforms, code points
outside the BMP are stored as surrogate pairs.
also see:
http://pyref.infogami.com/type-unicode
</F>
More information about the Python-list
mailing list