0

I got the following error. Does anybody know how to get the Unicode character corresponding to a large code point? Thanks.

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> unichr(119964)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
user1424739
  • 11,937
  • 17
  • 63
  • 152
  • Possible duplicate of [ValueError: unichr() arg not in range(0x10000) (narrow Python build)](https://stackoverflow.com/questions/7105874/valueerror-unichr-arg-not-in-range0x10000-narrow-python-build) – snakecharmerb Aug 12 '19 at 14:49

1 Answers1

1

Looks like your python is configured as UCS2. From the documentation

Return the Unicode string of one character whose Unicode code is the integer i. For example, unichr(97) returns the string u'a'. This is the inverse of ord() for Unicode strings. The valid range for the argument depends how Python was configured – it may be either UCS2 [0..0xFFFF] or UCS4 [0..0x10FFFF]. ValueError is raised otherwise. For ASCII and 8-bit strings see chr().

As has been posted above in a comment this question has various answers that my provide you with a workaround.

JGNI
  • 3,933
  • 11
  • 21