Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

I observed the following error on Python with print statement.

UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 1433-1433: Non-BMP character not supported in Tk


What I have tried:

What I've done is search twitter with specific hashtags and simply print them. As explained I tried to mark them to support BMP as follows. Still I end up with the same error.

Python
import sys
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd)
print(status.text.translate(non_bmp_map))


Could you please help me on this?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900