After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 566358 - Gtranslator crashes while opening a non UTF-8 file
Gtranslator crashes while opening a non UTF-8 file
Status: RESOLVED FIXED
Product: gtranslator
Classification: Other
Component: general
HEAD
Other All
: Normal major
: 2.0
Assigned To: Seán de Búrca
gtranslator-maint
: 649907 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-01-02 20:41 UTC by Jorge González
Modified: 2012-04-21 15:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Bakery translation (5.39 KB, text/plain)
2009-01-03 16:41 UTC, Jorge González
  Details
patch (9.75 KB, patch)
2012-04-21 15:04 UTC, Carlos Garnacho
none Details | Review

Description Jorge González 2009-01-02 20:41:12 UTC
I tried to open a file coded with iso-8859-1 and gtranslator crashed, the same file, opened after converting it to UTF-8, worked fine.
Comment 1 Pablo Sanxiao 2009-01-03 16:18:50 UTC
Could you attach the file that cause the crash, please?
Comment 2 Jorge González 2009-01-03 16:41:37 UTC
Created attachment 125693 [details]
Bakery translation
Comment 3 Ignacio Casal Quinteiro (nacho) 2010-02-04 20:48:26 UTC
Probably when loading the messages list we should check the encoding and convert it internally. But this is not a trivial fix and I hate encodings.
Comment 4 Ignacio Casal Quinteiro (nacho) 2011-05-10 19:01:20 UTC
*** Bug 649907 has been marked as a duplicate of this bug. ***
Comment 5 Ignacio Casal Quinteiro (nacho) 2012-03-13 19:55:41 UTC
I am really not interested on fighting with encoding, I had enough with gedit, so if anybody wants to fix it, patches are welcomed. Although at least we should detect that the file is not utf-8 and error out instead of just crash :)
Comment 6 Daniel Mustieles 2012-03-22 13:27:48 UTC
Using the last version from git, and the file attached by Jorge, y can't reproduce the bug.

I'm able to open, edit, and save the po file. Although there are several errors in the console, program seems to work fine.

BTW, I'm including it in the bugs list to review it in the upcoming hackfest.
Comment 7 Carlos Garnacho 2012-04-21 11:22:29 UTC
I agree encoding guessing is a hard fight to win, gtranslator could at least detect the encoding is not UTF-8 and offer UI to select the encoding. In those cases having a checkbox in the preferences or save dialog to convert the file from the selected encoding to UTF-8 could help, or just do that by default :)
Comment 8 Carlos Garnacho 2012-04-21 15:04:26 UTC
Created attachment 212509 [details] [review]
patch

This patch in the end uses the charset specified in Content-Type, if the conversion fails, a message is shown to suggest manual conversion
Comment 9 Carlos Garnacho 2012-04-21 15:15:15 UTC
Got Nacho's approval via IRC and committed this patch :), now available as 309b5e382