Comment 16 for bug 978654

Revision history for this message
Fotis Tsamis (ftsamis) wrote : Re: <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)

It seems that Alkis is correct!

The variable 'value' inside the last_package method (aptdaemon/pkcompat.py, line 670), which is called a little after the 'Check' button is pressed, contains the package name, the available new version, the architecture AND the PPA's description string (separated with a semicolon).

E.g.: numlockx;1.2-4;i386;Αποθετήριο Τεχνικής Στήριξης ΣΕΠΕΗΥ

Now, if the PPA's description contains only ascii letters it's all good. If not (as in the example above) we have an exception.
In line 671, the 'value' variable (a str object) is passed as a parameter to the dbus.String() function which expects a unicode object. So dbus.String tries to convert it using a plain .decode() which uses ascii as the default codec and boom: 'ascii codec can't decode [...]' :)

As Alkis stated the solution is to convert the 'value' variable to a unicode object with value.decode('utf-8') before passing it to dbus.String() so it will try to convert the str to unicode using the utf-8 codec instead of ascii.

I have included a patch fixing the problem.
Fotis