‘UCS-2’ codec can’t encode characters in position 1050-1050

Your data contains characters outside of the Basic Multilingual Plane. Emoji’s for example, are outside the BMP, and the window system used by IDLE, Tk, cannot handle such characters. You could use a translation table to map everything outside of the BMP to the replacement character: import sys non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd) … Read more