##// END OF EJS Templates
cast clipboard_get strings on OSX and Linux to unicode
Jörgen Stenarson -
Show More
@@ -5,7 +5,7 b' import subprocess'
5 import sys
5 import sys
6
6
7 from IPython.core.error import TryNext
7 from IPython.core.error import TryNext
8
8 import IPython.lib.py3compat as py3compat
9
9
10 def win32_clipboard_get():
10 def win32_clipboard_get():
11 """ Get the current clipboard's text on Windows.
11 """ Get the current clipboard's text on Windows.
@@ -31,6 +31,7 b' def osx_clipboard_get():'
31 text, stderr = p.communicate()
31 text, stderr = p.communicate()
32 # Text comes in with old Mac \r line endings. Change them to \n.
32 # Text comes in with old Mac \r line endings. Change them to \n.
33 text = text.replace('\r', '\n')
33 text = text.replace('\r', '\n')
34 text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING)
34 return text
35 return text
35
36
36 def tkinter_clipboard_get():
37 def tkinter_clipboard_get():
@@ -49,6 +50,7 b' def tkinter_clipboard_get():'
49 root.withdraw()
50 root.withdraw()
50 text = root.clipboard_get()
51 text = root.clipboard_get()
51 root.destroy()
52 root.destroy()
53 text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING)
52 return text
54 return text
53
55
54
56
General Comments 0
You need to be logged in to leave comments. Login now