Py 3.3, unicode / upper()

Terry Reedy tjreedy at udel.edu
Thu Dec 20 01:39:22 CET 2012


On 12/19/2012 10:40 AM, Chris Angelico wrote:

> Interestingly, IDLE on my Windows box can't handle the bolded
> characters very well...
>
>>>> s="\U0001d407\U0001d41e\U0001d425\U0001d425\U0001d428, \U0001d430\U0001d428\U0001d42b\U0001d425\U0001d41d!"
>>>> print(s)
> Traceback (most recent call last):
>    File "<pyshell#2>", line 1, in <module>
>      print(s)
> UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001d407'
> in position 0: Non-BMP character not supported in Tk

On 3.3.0 on Win7 , the expressions 's', 'repr(s)', and 'str(s)' (without 
the quotes) echo the input as entered (with \U escapes) while 'print(s)' 
gets the same traceback you did.



-- 
Terry Jan Reedy




More information about the Python-list mailing list