Comment 2 for bug 846044

Revision history for this message
Daniel Manrique (roadmr) wrote :

Looking at all the duplicate reports, this happens with any language that uses non-ascii characters (those above ASCII 127) - potentially every language but english.

However this only affects a few software packages; I was able to correctly install vlc and flash plugin using a german-language system, but installing mouse trap (the one that controls the mouse with the webcam) fails and reproduces the error.

Steps to reproduce:

0 - I'm using a fully-updated Oneiric installation with software-center 4.1.22.
1 - Install a language that may contain non-ascii characters (the duplicates indicate this may happen in spanish (mexico), portuguese (portugal) and I managed to reproduce it in german (austria)):
   sudo apt-get install language-pack-de language-pack-gnome-de
2- Launch software center from a terminal, using this installed language:
  LANG=de_AT.UTF-8 LANGUAGE=de_AT:de software-center
3- Search for and try to install "mousetrap" (the mouse controlling app, not the game)

Expected result:
- App installs with no errors

Actual result:
- As described in the original report, software center crashes with the given trace.

It looks like somewhere, there is a call to the "unicode" python function, which defaults to using the ascii encoder, so any character in the string to be encoded that can't be encoded as 7-bit ascii will throw the exception.

We saw something similar in bug 833747 and the solution was to explicitly specify the encoder in the call to unicode:

unicode(string,"utf8") instead of unicode(string)

Of course, tracing the actual call to unicode was the tricky part as this is sometimes done implicitly. Also this may cause "secondary effects" and need code changes elsewhere (in bug 833747 we also required some changes to the text sent to a Gtk.TextBuffer to force encoding the unicode into utf8).

I'm setting this bug to triaged and importance: Critical as it has a "severe impact in a large portion of Ubuntu users" - Unreliability and crashes in Software Center, one of Ubuntu's flagship apps, for potentially anyone not on an English locale seems pretty critical to me.