Message160378
With the text 'abc€' copied to the clipboard, on Linux, where UTF-8 is the default encoding:
Python 3.2.3 (default, Apr 12 2012, 21:55:50)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> root = tkinter.Tk()
>>> root.clipboard_get()
'abcâ\x82¬'
>>> 'abc€'.encode('utf-8').decode('latin-1')
'abcâ\x82¬'
I see the same behaviour in 2.7.3 as well (it returns a unicode string u'abc\xe2\x82\xac').
If the clipboard is only accessible at a bytes level, I think clipboard_get should return a bytes object. But I can reliably copy and paste non-ascii characters between programs, so it looks like it's possible to return unicode. |
|
Date |
User |
Action |
Args |
2012-05-10 22:47:57 | takluyver | set | recipients:
+ takluyver |
2012-05-10 22:47:57 | takluyver | set | messageid: <1336690077.5.0.0628232128549.issue14777@psf.upfronthosting.co.za> |
2012-05-10 22:47:56 | takluyver | link | issue14777 messages |
2012-05-10 22:47:56 | takluyver | create | |
|