Unicode support in Python 2.7.8 - 16 bit

John Nagle nagle at animats.com
Tue Mar 7 17:05:15 EST 2017


    How do I test if a Python 2.7.8 build was built for 32-bit
Unicode?  (I'm dealing with shared hosting, and I'm stuck
with their provided versions.)

If I give this to Python 2.7.x:

     sy = u'\U0001f60f'

len(sy) is 1 on a Ubuntu 14.04LTS machine, but 2 on the
Red Hat shared hosting machine.  I assume "1" indicates
32-bit Unicode capability, and "2" indicates 16-bit.
It looks like  Python 2.x in 16-bit mode is using a UTF-16
pair encoding, like Java. Is that right?  Is it documented
somewhere?

(Annoyingly, while the shared host has a Python 3, it's
3.2.3, which rejects "u" Unicode string constants and
has other problems in the MySQL area.)

			John Nagle





More information about the Python-list mailing list