Public bug reported:

Binary package hint: gedit

Some friend found a problem with the Python Console plugin in gedit
2.22.3-0ubuntu1, coming with Ubuntu 8.04(.1).

When inputing some utf-8 encoded text, it's evaluated as a byte string
instead, meaning it's not decoded as it should and as it effectively is
in an external "python" or "ipython" ran into a terminal.

Here is some example to reproduce and understand the bug:

1/ in a gedit Python Console:

  >>> ch = u"Stéphanie"
  >>> ch
  u'St\xc3\xa9phanie'
  >>> print ch[2]
  Ã

2/ in a "python" command run in a terminal:

  >>> ch = u"Stéphanie"
  >>> ch
  u'St\xe9phanie'
  >>> print ch[2]
  é

We could explicitly ask for input decoding using """ch =
'Stéphanie'.decode('utf-8')""" and that works, of course, but I think it
should be managed at the gedit plugin level instead, since the whole
Gnome environment is using Unicode and the plugin should be aware of
that.


Now, about some solution, here is what I did to correct this problem, but I'm 
not (yet ;-) ) a Python expert, so...
sudo sed -i -e '/get_text(inp, cur)$/s/$/.decode('utf-8')/' 
/usr/lib/gedit-2/plugins/pythonconsole/console.py
sudo python2.5 /usr/lib/python2.5/py_compile.py 
/usr/lib/gedit-2/plugins/pythonconsole/console.py

Explanation: add explicit 'utf-8' decoding anywhere the code get the
text input from the Python Console interface.

ProblemType: Bug
Architecture: i386
Date: Sun Oct  5 04:51:26 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/bin/gedit
Package: gedit 2.22.3-0ubuntu1 [modified: 
usr/lib/gedit-2/plugins/pythonconsole/console.py]
PackageArchitecture: i386
ProcEnviron:
 SHELL=/bin/bash
 PATH=/home/User 
Name/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
 LANG=fr_FR.UTF-8
SourcePackage: gedit
Uname: Linux 2.6.24-19-generic i686

** Affects: gedit (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug

-- 
missing utf-8 input decoding in the Python Console plugin
https://bugs.launchpad.net/bugs/278341
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to