Crashed with UnicodeDecodeError while opening about dialog

Bug #1083418 reported by Raúl Soriano
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Accomplishments Viewer
Fix Committed
Undecided
Unassigned

Bug Description

Tried to open the about dialog and a traceback was dumped:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/accomplishments_viewer_lib/Window.py", line 87, in on_mnu_about_activate
    about = self.AboutDialog() # pylint: disable=E1102
  File "/usr/lib/python2.7/dist-packages/accomplishments_viewer_lib/AboutDialog.py", line 34, in __new__
    new_object.finish_initializing(builder)
  File "/usr/lib/python2.7/dist-packages/accomplishments_viewer/AboutAccomplishmentsViewerDialog.py", line 48, in finish_initializing
    authors.append("'" + self.libaccom.get_collection_name(col) + "' " + _("Collection Authors:"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

This happened while using accomplishments-viewer 0.3~quantal2 as available at:
500 http://ppa.launchpad.net/ubuntu-accomplishments/releases/ubuntu/ quantal/main amd64 Packages

Raúl Soriano (gatoloko)
description: updated
Revision history for this message
Matt Fischer (mfisch) wrote :

I'm sure this was from changing Jose's name to have the accented e character, but we need to fix it in the viewer, thanks for filing.

Revision history for this message
Matt Fischer (mfisch) wrote :

Actually you said Release not Daily, so that doesn't make sense. I cannot repro this, can you try the daily PPA and see if it still happens?

The daily is here:
https://launchpad.net/~ubuntu-accomplishments-admins/+archive/daily

Changed in ubuntu-accomplishments-viewer:
status: New → Incomplete
Revision history for this message
Raúl Soriano (gatoloko) wrote :

Removed the "releases" repo, added the "daily" repo, updated packages to 0.3~quantal2+220~quantal1 and run it and tried the about dialog again:

$ accomplishments-viewer

(accomplishments-viewer:13309): Gtk-WARNING **: Theme parsing error: gtk.css:1:58: Failed to import: El recurso en «/org/gnome/adwaita/gtk-main.css» no existe
ERROR:root:Could not find any typelib for GwibberGtk
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/accomplishments_viewer_lib/Window.py", line 87, in on_mnu_about_activate
    about = self.AboutDialog() # pylint: disable=E1102
  File "/usr/lib/python2.7/dist-packages/accomplishments_viewer_lib/AboutDialog.py", line 34, in __new__
    new_object.finish_initializing(builder)
  File "/usr/lib/python2.7/dist-packages/accomplishments_viewer/AboutAccomplishmentsViewerDialog.py", line 48, in finish_initializing
    authors.append("'" + self.libaccom.get_collection_name(col) + "' " + _("Collection Authors:"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

My intuition tells me someone might have again contributed a malicious translation, this has happened before. What's the language you're using, Spanish?

Revision history for this message
Raúl Soriano (gatoloko) wrote :

Yes, I'm using Spanish. I've tried to launch it form a terminal like this:

LANG=en_US.UTF8 LC_COLLATE=en_US.UTF8 LC_CTYPE=en_US.UTF8 LC_MESSAGES=en_US.UTF8 LC_ALL=en_US.UTF8 accomplishments-viewer

But it made no difference, still appeared in Spanish.

Revision history for this message
Raúl Soriano (gatoloko) wrote :

Just for fun I've moved the Spanish accomplishments-daemon.mo and accomplishments-viewer.mo files out of the way and now there are no backtraces, and the about dialog is shown (while it didn't before), so it's clear the problem happens while trying to manage translated strings.

The question now is, why are strings treated as ascii? Shouldn't everybody be using UTF8 by now? As far as I can remember Ubuntu has been using it since forever, and this will be a problem when python 3 is made default.

P.S.: Most strings are in English now, but there are some Spanish translated ones in the about dialog, with characters like "á" and "Í" (accentuated capital i).

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote : Re: [Bug 1083418] Re: Crashed with UnicodeDecodeError while opening about dialog

The language variables will not affect the trophies text, they will
affect only viewers GUI.

According to the backtrace, the problem emerges on that string:

https://translations.launchpad.net/ubuntu-accomplishments-viewer/trunk/+pots/accomplishments-viewer/es/+translate?batch=10&show=all&search=Collection+Authors

The only non-ascii letter I see there is ó, and probably this is
what's causing problems.

Revision history for this message
Raúl Soriano (gatoloko) wrote :

That translation is correct for that string, and I can't think of any way to say the same with other words without altering the meaning.

In any case, I don't think the problem is in the translation, but in how the programs handle strings. What will happen when somebody translates it to Chinese, Russia, Japanese or Arabic? Those languages make a heavy use of non ascii characters, and many other languages, while still using the Latin alphabet, need non ascii characters (even your surname and my name need them).

Modifying the translation so it doesn't include nonascii characters isn't a fix, but a bad workaround evading the actual bug.

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Sorry, I did not mean that we may want to modify the translation, I am perfectly fine with correct form, I was investigating crash reason. The program handles non-ascii characters perfectly, I use a Polish translation everyday, which uses tons of such chars, I remeber that Russian language worked good too.
I am also wondering why 'ascii' codec is in use for your locale. I'll check whether gettext is initialised properly for the About dialog.
What are the LANG (etc.) environmental variables set to on your system (when starting the viewer)? I would like to reproduce this bug on my machine to investigate it further.

Changed in ubuntu-accomplishments-viewer:
status: Incomplete → New
Revision history for this message
Raúl Soriano (gatoloko) wrote :

Sorry, I misinterpreted you.

This are my locales:

~$ locale
LANG=es_ES.UTF-8
LANGUAGE=es_ES:en
LC_CTYPE=es_ES.UTF-8
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE=es_ES.UTF-8
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES=es_ES.UTF-8
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Raul,
I have just applied a change that is very likely to fix the problem you are experiencing. Could you please verify if it works correctly now?

To test it, you will need to use our daily-builds PPA (ppa:ubuntu-accomplishments-admins/daily). You will need new packages both for the daemon and the viewer.
The fix I would like you to try will be present with viewer's package in version 0.3~quantal2+228 or anything newer. This version is currently building at launchpad and should be ready within an hour.

Please let me know if the problem persists, or if you need guidance with testing this fix.

Revision history for this message
Raúl Soriano (gatoloko) wrote :

Just tested it and it's fixed. The about dialog opens and shows those "problematic" characters correctly. Thanks.

Changed in ubuntu-accomplishments-viewer:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.