[Bug 978654] Re: <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)

Fotis Tsamis ftsamis at gmail.com
Fri Sep 14 22:57:12 UTC 2012


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

** Attachment added: "patch"
   https://bugs.launchpad.net/ubuntu/+source/aptdaemon/+bug/978654/+attachment/3315542/+files/patch

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to aptdaemon in Ubuntu.
https://bugs.launchpad.net/bugs/978654

Title:
  <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode
  byte 0xc3 in position 24: ordinal not in range(128)

Status in Aptdaemon:
  New
Status in “aptdaemon” package in Ubuntu:
  Confirmed

Bug description:
  No noticable problems - this message came up during boot

  ProblemType: Crash
  DistroRelease: Ubuntu 12.04
  Package: aptdaemon 0.43+bzr805-0ubuntu1
  ProcVersionSignature: Ubuntu 3.2.0-23.36-generic-pae 3.2.14
  Uname: Linux 3.2.0-23-generic-pae i686
  NonfreeKernelModules: nvidia
  Annotation: Search failed
  ApportVersion: 2.0.1-0ubuntu1
  Architecture: i386
  Date: Tue Apr 10 07:45:48 2012
  ExecutablePath: /usr/sbin/aptd
  PackageArchitecture: all
  SourcePackage: aptdaemon
  Title: <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)
  TransactionDepends: [[], [], [], [], [], [], []]
  TransactionErrorCode: error-unknown
  TransactionKwargs: {'filters': [u'unknown']}
  TransactionLocale: en_GB.UTF-8
  TransactionOutput:
   
  TransactionPackages: [[], [], [], [], [], []]
  TransactionRole: role-pk-query
  UpgradeStatus: Upgraded to precise on 2012-02-26 (44 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/aptdaemon/+bug/978654/+subscriptions




More information about the foundations-bugs mailing list