Message160378
| Author |
takluyver |
| Recipients |
takluyver |
| Date |
2012年05月10日.22:47:56 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1336690077.5.0.0628232128549.issue14777@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|