GNOME Bugzilla – Bug 566358
Gtranslator crashes while opening a non UTF-8 file
Last modified: 2012-04-21 15:15:15 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.
Could you attach the file that cause the crash, please?
Created attachment 125693 [details] Bakery translation
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.
*** Bug 649907 has been marked as a duplicate of this bug. ***
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 :)
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.
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 :)
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
Got Nacho's approval via IRC and committed this patch :), now available as 309b5e382