[Python-Dev] New Py_UNICODE doc

"Martin v. Löwis" martin at v.loewis.de
Sat May 7 01:37:37 CEST 2005


Nicholas Bastin wrote:
> I'm not sure the Python documentation is the place to teach someone
> about unicode.  The ISO 10646 pretty clearly defines UCS-2 as only
> containing characters in the BMP (plane zero).  On the other hand, I
> don't know why python lets you choose UCS-2 anyhow, since it's almost
> always not what you want.

It certainly is, in most cases. On Windows, it is the only way to
get reasonable interoperability with the platform's WCHAR (i.e.
just cast a Py_UNICODE* into a WCHAR*).

To a limited degree, in UCS-2 mode, Python has support for surrogate
characters (e.g. in UTF-8 codec), so it is not "pure" UCS-2, but
this is a minor issue.

Regards,
Martin


More information about the Python-Dev mailing list