Skip to content

Instantly share code, notes, and snippets.

@tdsmith
Created September 18, 2014 00:59
Show Gist options
  • Save tdsmith/e8b46f5a7ce49b63fb7f to your computer and use it in GitHub Desktop.
Save tdsmith/e8b46f5a7ce49b63fb7f to your computer and use it in GitHub Desktop.

On a narrow build:

>>> ghost = u'👻'
>>> repr(ghost)
"u'\\U0001f47b'"
>>> print u'\U0001f47b'
👻
>>> g = 0x0001f47b
>>> unichr(g)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
>>> ('\\U%08x' % g).decode('unicode-escape')
u'\U0001f47b'
>>> print ('\\U%08x' % g).decode('unicode-escape')
👻
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment