Bug 142325 - error message uses wrong encoding
Summary: error message uses wrong encoding
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: bookmarks (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-28 14:54 UTC by Olivier Vitrat
Modified: 2007-03-15 20:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of the error dialog (17.38 KB, image/png)
2007-02-28 20:16 UTC, Jens Seidel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Vitrat 2007-02-28 14:54:28 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
OS:                Linux

Hi,

I was recently out of disk space and tried to find a new hard disk on my
favourite shop. The following warning occured:

Speichern der Lesezeichen in /home/jens/.kde/share/apps/konqueror/bookmarks.xml
nicht möglich. Der angegebene Fehler lautet: Auf dem Gerät ist kein
Speicherplatz mehr verfügbar. Die Meldung wird nur einmal angezeigt. Die
Ursache sollte so rasch wie möglich beseitigt werden. Wahrscheinlich ist die
Festplattenkapazität erschöpft.

English:
Could not save bookmarks in /home/jens/.kde/share/apps/konqueror/bookmarks.xml.
The returned error is: No diskspace available on device. The message is displayed
only once. Fix the problem as soon as possible. Probably the hard disk is full.

The problem is that the returned error message is wrongly encoded.

Whereas the system used UTF-8 as default, konqueror assumes ASCII (latin1).
Expected: "Auf dem Gerät ist kein Speicherplatz mehr verfügbar."
Recieved: "Auf dem Gerät ist kein Speicherplatz mehr verfügbar."

That's the result of converting an UTF-8 encoded string from latin1 to UTF-8.

an other way to reproduce:

Since I'm currently not out of hard disk space I need another error
message. I tried:

$ chmod a-w ~/.kde/share/apps/konqueror/bookmarks.xml

Now I started konqueror 3.5.5 "release 45" (from a OpenSuse 10.2
system, but it shouldn't matter) in a classical fr_FR locale (uses latin1):
$ LANG=fr_FR konqueror
and obtained after trying to save bookmarks: "Permission non accordée."

The same using fr_FR.utf-8 results in "Permission non accordée."

(The German string doesn't contain non 8-bit characters, that's why I
used French ones.)

Jens
Comment 1 Olivier Vitrat 2007-02-28 15:04:02 UTC
This is a Debian BTS report
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=362653
Comment 2 Thomas Reitelbach 2007-02-28 17:41:54 UTC
If the same bug exists in german and french language, then i doubt that it's a i18n bug.
It's more likely a bug in konqueror sourcecode.

Olivier: Do you have a screenshot of the bug, so that we can see it "in action" and with a context? Is this error message displayed in a dialog window or is it shown as text in the rendering area of konqueror?
How do you change the locale used for konqueror exactly (what's the exact command)?
Comment 3 Jens Seidel 2007-02-28 20:16:14 UTC
Created attachment 19852 [details]
Screenshot of the error dialog

Hi,

I attached a screnshot of the error dialog.

I selected the locale using
LANG=fr_FR.utf8 konqueror

The problem is simple: Konqueror assumes system error messages are encoded in
latin1 instead of the system locale and tries to convert the message from
latin1 into utf8.

Jens
Comment 4 Thomas Reitelbach 2007-02-28 22:04:03 UTC
I cannot see the bug myself, but i had a look at the code and it seems the errormessage just takes the system-message (permission denied) and includes it into the translated message. 

I guess the responsible .arg() argument in kdelibs/kio/bookmarks/kbookmarkmanager.cc:369 needs a "fromLocal8Bit()" in some way. But my limited programming skills don't suffice to solve this bug. Thus i reassign it back to the konqueror developers.

Cheers
Thomas
Comment 5 Thomas Reitelbach 2007-03-14 18:39:18 UTC
forgot to reassign the bug to the konqi devs, sorry for the delay.
Comment 6 Thomas Reitelbach 2007-03-15 20:26:52 UTC
ok, this patch against KDE 3.5 should fix the bug:

Index: bookmarks/kbookmarkmanager.cc
===================================================================
--- bookmarks/kbookmarkmanager.cc       (Revision 642839)
+++ bookmarks/kbookmarkmanager.cc       (Arbeitskopie)
@@ -366,7 +366,7 @@
                              "This error message will only be shown once. The cause "
                              "of the error needs to be fixed as quickly as possible, "
                              "which is most likely a full hard drive.")
-                        .arg(filename).arg(strerror(file.status()));
+                        .arg(filename).arg(QString::fromLocal8Bit(strerror(file.status())));
         if (qApp->type() != QApplication::Tty)
             KMessageBox::error( 0L, error );
         else
Comment 7 Thomas Reitelbach 2007-03-15 20:32:50 UTC
SVN commit 642895 by reitelbach:

use correct encoding for the errormessage that comes from the OS

BUG:142325


 M  +1 -1      kbookmarkmanager.cc  


--- branches/KDE/3.5/kdelibs/kio/bookmarks/kbookmarkmanager.cc #642894:642895
@@ -366,7 +366,7 @@
                              "This error message will only be shown once. The cause "
                              "of the error needs to be fixed as quickly as possible, "
                              "which is most likely a full hard drive.")
-                        .arg(filename).arg(strerror(file.status()));
+                        .arg(filename).arg(QString::fromLocal8Bit(strerror(file.status())));
         if (qApp->type() != QApplication::Tty)
             KMessageBox::error( 0L, error );
         else