Below is a simple test. repr
seems to work fine. yet len
and x for x in
doesn't seem to divide the unicode text correctly in Python 2.6 and 2.7:
In [1]: u"
Below is a simple test. repr
seems to work fine. yet len
and x for x in
doesn't seem to divide the unicode text correctly in Python 2.6 and 2.7:
In [1]: u"
Yes, provided you compiled your Python with wide-unicode support.
By default, Python is built with narrow unicode support only. Enable wide support with:
You can verify what configuration was used by testing
sys.maxunicode
:A wide build will use UCS4 characters for all unicode values, doubling memory usage for these. Python 3.3 switched to variable width values; only enough bytes are used to represent all characters in the current value.
Quick demo showing that a wide build handles your sample Unicode string correctly: