[gedit/wip/python3] Ensure the command it is utf-8 before decoding it



commit 3ab7cbe306d5a98eefb99e2943dddba25131c394
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Oct 25 22:33:22 2012 +0200

    Ensure the command it is utf-8 before decoding it

 plugins/pythonconsole/pythonconsole/__init__.py |    4 ++--
 plugins/pythonconsole/pythonconsole/console.py  |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/plugins/pythonconsole/pythonconsole/__init__.py b/plugins/pythonconsole/pythonconsole/__init__.py
index cbe2a01..0d33608 100644
--- a/plugins/pythonconsole/pythonconsole/__init__.py
+++ b/plugins/pythonconsole/pythonconsole/__init__.py
@@ -43,8 +43,8 @@ class PythonConsolePlugin(GObject.Object, Gedit.WindowActivatable, PeasGtk.Confi
         self._console = PythonConsole(namespace = {'__builtins__' : __builtins__,
                                                    'gedit' : Gedit,
                                                    'window' : self.window})
-        self._console.eval('print "You can access the main window through ' \
-                           '\'window\' :\\n%s" % window', False)
+        self._console.eval('print("You can access the main window through ' \
+                           '\'window\' :\\n%s" % window)', False)
         bottom = self.window.get_bottom_panel()
         image = Gtk.Image()
         image.set_from_icon_name(PYTHON_ICON, Gtk.IconSize.MENU)
diff --git a/plugins/pythonconsole/pythonconsole/console.py b/plugins/pythonconsole/pythonconsole/console.py
index ac57368..7d3f032 100644
--- a/plugins/pythonconsole/pythonconsole/console.py
+++ b/plugins/pythonconsole/pythonconsole/console.py
@@ -209,7 +209,7 @@ class PythonConsole(Gtk.ScrolledWindow):
                 com_mark = "... "
             else:
                 # Eval the command
-                self.__run(self.current_command)
+                self.__run(bytes(self.current_command, 'utf-8'))
                 self.current_command = ''
                 self.block_command = False
                 com_mark = ">>> "
@@ -356,11 +356,11 @@ class PythonConsole(Gtk.ScrolledWindow):
             for c in command:
                 if display_command:
                     self.write(">>> " + c + "\n", self.command)
-                self.__run(c)
+                self.__run(bytes(c, 'utf-8'))
         else:
             if display_command:
                 self.write(">>> " + c + "\n", self.command)
-            self.__run(command)
+            self.__run(bytes(command, 'utf-8'))
 
         cur = buf.get_end_iter()
         buf.move_mark_by_name("input-line", cur)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]