[Bug 420683] Re: gdk-update-viewer UnicodeDecodeError

Ulf Rompe launchpad.net at rompe.org
Mon Sep 7 05:57:12 UTC 2009


This bug persists in 2.27.2-0ubuntu3. Line number are slightly different
of course:

Error Type: <type 'exceptions.UnicodeDecodeError'>
Error Value: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)
  File : /usr/share/PackageKit/helpers/apt/aptBackend.py, line 1948, in <module>
    main()
  File : /usr/share/PackageKit/helpers/apt/aptBackend.py, line 1945, in main
    run(args, options.single)
  File : /usr/share/PackageKit/helpers/apt/aptBackend.py, line 1907, in run
    backend.dispatcher(args)
  File : /usr/lib/python2.6/dist-packages/packagekit/backend.py, line 636, in dispatcher
    self.dispatch_command(args[0], args[1:])
  File : /usr/lib/python2.6/dist-packages/packagekit/backend.py, line 537, in dispatch_command
    self.get_update_detail(package_ids)
  File : /usr/share/PackageKit/helpers/apt/aptBackend.py, line 753, in get_update_detail
    updated)
  File : /usr/lib/python2.6/dist-packages/packagekit/backend.py, line 242, in update_detail
    changelog, state, issued, updated))


Cause of the problem:
For packages without changelogs available (which is the case for PPAs) a message stating this circumstance is printed instead. This string is internationalized and may contain non-ascii characters in languages != C. For example, in de_DE.UTF-8 the "changelog" variable contains 'Die Liste der \xc3\x84nderungen ist momentan nicht verf\xc3\xbcgbar.' Note that it seems to be a plain string, not a Unicode string. I traced this down using this simple patch:

--- /usr/lib/python2.6/dist-packages/packagekit/backend.py.orig	2009-09-07 06:54:18.000000000 +0200
+++ /usr/lib/python2.6/dist-packages/packagekit/backend.py	2009-09-07 07:55:02.000000000 +0200
@@ -236,6 +236,10 @@
         @param issued:
         @param updated:
         '''
+	try:
+            changelog = changelog.encode("ascii", "replace")
+        except UnicodeDecodeError:
+            changelog = repr(changelog)
         self._send("updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t"
                   "%s" % (package_id, updates, obsoletes, vendor_url,
                           bugzilla_url, cve_url, restart, update_text,

-- 
gdk-update-viewer UnicodeDecodeError
https://bugs.launchpad.net/bugs/420683
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

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




More information about the universe-bugs mailing list