On 1/7/2013 7:57 AM, Franck Ditter wrote:
<<< print('\U0001d11e')
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
print('\U0001d11e')
UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001d11e'
in position 0: Non-BMP character not supported in Tk
The message comes from printing to a tk text widget (the IDLE shell),
not from creating the 1 char string. c = '\U0001d11e' works fine. When
you have problems with creating and printing unicode, *separate*
creating from printing to see where the problem is. (I do not know if
the brand new tcl/tk 8.6 is any better.)
The windows console also chokes, but with a different message.
>>> c='\U0001d11e'
>>> print(c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Programs\Python33\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001d11e'
in posit
ion 0: character maps to <undefined>
Yes, this is very annoying, especially in Win 7.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list