News for hackers. Stuff that matters.
Re:Unicode In Python, Completely Demystified by gorset on Saturday February 26, 2011 @05:28PM (#2266680)
CPython aren't actually using unicode strings. Instead of having a sequence of codepoints, you will have either UCS2 or UCS4 strings depending on compile time options.

For example, freshly installed python3.2 from macports:

    >>> len(chr(119074))
    2
    >>> chr(119074)
    '𝄢'
    >>> print chr(119074)
    𝄢
(Surrogates are so much fun).

Python 2.7.1 compiled with UCS4:

    >>> len(unichr(119074))
    1
    >>> unichr(119074)
    u'\U0001d122'
    >>> print(chr(119074))
    𝄢
Notice the capital U takes 8 instead of 4 hexidecimals.

There are no comments on this comment yet.