collective/buildout.python — pull request #32 by phihag (2013-05-14 17:32:23+00:00)
Title: Enable wide unicode support in Python<3.3

The python by generated by buildout.python does not support arbitrary characters because it compiles the so-called "narrow" (which should really be called "buggy") version of Python.

Wide builds [are available since cPython 2.2](http://www.python.org/dev/peps/pep-0261/). Narrow builds [have been removed in cPython 3.3](http://docs.python.org/dev/whatsnew/3.3.html#pep-393-flexible-string-representation).

A simple check to see whether the installed Python is buggy is verifying that

assert len(u'\U0001d550') == 1

in Python 2.x or

assert len('\U0001d550') == 1

in Python 3.1 and 3.2 does not throw any exceptions. For a version-independent (but not as obvious) test, try

getattr(__builtins__, 'unichr', chr)(120144)