Bug 186038

Summary: Programs cannot be called on paths containing non-ascii utf8 characters
Product: [Frameworks and Libraries] kio Reporter: Alex Dănilă <alex.danila.web>
Component: fileAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: 4ernov, bluedzins, christopher.m.braeuer, desintegr, dsent.zen, echidnaman, fabo, faure, hugo_alobo, javierjc1982, kdebugs.20.orzelf, kojot350, kostiagol, krege, mail, matija, Mikolaj.Q, mkyral, nadavkav, null, olegator1, payableondeath90, pierre, pitachx, realnc, ria.freelander, updatedb, vmrnkv, wbsoft, wstephenson, zdenek.zikan
Priority: NOR    
Version: 0.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Possible fix for gwenview
System setting incorrect title after start.
linux-specific qt version check

Description Alex Dănilă 2009-03-03 14:08:25 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Debian testing/unstable Packages

KDE 4 programs cannot be launched to open files from paths containing diacritics, in this example "ă" and "ţ". But they are able to open the file if I choose it from the open file dialog.

Command line example:
$ pwd
/home/alex/cărţi

$ okular cheatsheet.pdf
Okular dialog says: "Could not open file:///home/alex/cÄrÅ£i/cheatsheet.pdf"

$ okteta cheatsheet.pdf
Okteta dialog says: "File '/home/alex/cÄrÅ£i/cheatsheet.pdf' is not readable."

$ khexedit cheatsheet.pdf
KHexEdit opens the files correctly.

The exact same thing happens if I launch the program from Konqueror or Dolphin.
I think this is a bug newly introduced with KDE 4.2.1, but I haven't yet downgraded to check it.

Running KDE 4.2.1 from the Debian Experimental repositories.
Comment 1 Alex Dănilă 2009-03-03 14:13:43 UTC
Clarification, I believe the bug was introduced in the transition from 4.2.0 to 4.2.1. I am almost sure of this because I have many of those paths on my hdd and I didn't have any problem until now. 

Unfortunately I don't know any way of downgrading to 4.2.0 now that 4.2.1 is default in the repositories, so I cannot 100% confirm this.
Comment 2 Jonathan Thomas 2009-03-04 04:05:16 UTC
I can confirm that the bug *doesn't* happen with KDE 4.2.0 (Kubuntu). I'm updating to KDE 4.2.1 at the moment, so I'll try again once the update is done.
Comment 3 Jonathan Thomas 2009-03-04 05:34:57 UTC
I can't reproduce the bug after upgrading to KDE 4.2.1. (Kubuntu packages)
It may be that I'm "lucky".
Comment 4 Fathi Boudra 2009-03-04 13:21:38 UTC
It seems a Qt issue.
Same kdelibs with Qt 4.4 works and with Qt 4.5 doesn't work.
Comment 5 Fathi Boudra 2009-03-04 13:24:08 UTC
why it works on Kubuntu ?
I guess KDE 4.2.1 is rebuilt against Qt 4.5, Debian packages aren't.
Comment 6 Alex Dănilă 2009-03-04 13:24:35 UTC
True, it is a Qt 4.5 problem.
Someone at Debian bugs (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518062) also told me that.
Indeed, after downgrading (dpkg abuse) to 4.4 this was solved.
Comment 7 Alex Dănilă 2009-03-05 12:31:03 UTC
I Consider it Debian bug and close for the moment.
Comment 8 German Pacenza 2009-03-05 13:57:07 UTC
I have the same bug in Fedora 10
kde 4.2.1
qt 4.5
Comment 9 Jonathan Thomas 2009-03-05 18:10:20 UTC
This bug isn't Debian's fault. The commandline test case is. After using the commandline test case, one must try to save the file for the bug to become apparent. Just opening it isn't enough.
Comment 10 David Faure 2009-03-05 19:25:16 UTC
This was a Qt-4.5 regression, which affected kde-4.2.0. We fixed this, but just after 4.2.1. (Rev r934640).

So I confirm: 
Qt-4.4 + KDE-4.2.* = no problem. 
Qt-4.5 + KDE-4.2.0 or 4.2.1 (*) = this bug.
Qt-4.5 + KDE >= 4.2.2 = fixed.

(*) some distros (like Mandriva) integrated the fix into their 4.2.1 packages though.

Everyone: you should expect problems if you use Qt-4.5 with KDE-4.2.0 (and still a few with 4.2.1). This isn't the version of Qt that was meant to be used with KDE-4.2 (it didn't even exist when 4.2.0 came out).
Comment 11 Jonathan Thomas 2009-03-06 16:56:02 UTC
*** Bug 186246 has been marked as a duplicate of this bug. ***
Comment 12 Jonathan Thomas 2009-03-06 21:26:39 UTC
*** Bug 186386 has been marked as a duplicate of this bug. ***
Comment 13 Marian Kyral 2009-03-06 23:04:00 UTC
(In reply to comment #10)
> This was a Qt-4.5 regression, which affected kde-4.2.0. We fixed this, but just
> after 4.2.1. (Rev r934640).
> 
> So I confirm: 
> Qt-4.4 + KDE-4.2.* = no problem. 
> Qt-4.5 + KDE-4.2.0 or 4.2.1 (*) = this bug.
> Qt-4.5 + KDE >= 4.2.2 = fixed.
> 
> (*) some distros (like Mandriva) integrated the fix into their 4.2.1 packages
> though.

I applied the patch and kwrite and okular works correctly now, but I still have an issue with gwenview. Maybe gwenview issue.

> 
> Everyone: you should expect problems if you use Qt-4.5 with KDE-4.2.0 (and
> still a few with 4.2.1). This isn't the version of Qt that was meant to be used
> with KDE-4.2 (it didn't even exist when 4.2.0 came out).

Yes, but even it works much better.
BTW, this bug come with 4.5.0 release. 4.5.0_rc1 had not this problem.
Comment 14 Pino Toscano 2009-03-07 18:59:38 UTC
*** Bug 186481 has been marked as a duplicate of this bug. ***
Comment 15 Pino Toscano 2009-03-08 11:09:23 UTC
*** Bug 186514 has been marked as a duplicate of this bug. ***
Comment 16 Jonathan Thomas 2009-03-08 19:59:27 UTC
*** Bug 186572 has been marked as a duplicate of this bug. ***
Comment 17 Pino Toscano 2009-03-09 21:26:08 UTC
*** Bug 186701 has been marked as a duplicate of this bug. ***
Comment 18 Pino Toscano 2009-03-10 09:48:51 UTC
*** Bug 186728 has been marked as a duplicate of this bug. ***
Comment 19 Jonathan Thomas 2009-03-10 13:30:43 UTC
*** Bug 186760 has been marked as a duplicate of this bug. ***
Comment 20 Nikos Chantziaras 2009-03-10 17:16:49 UTC
With the patch backported to 4.2.1, text files work now (Kate/Kwrite), but Gwenview is still bugged.  It can't open images containing non-latin characters.
Comment 21 Nikos Chantziaras 2009-03-10 17:27:19 UTC
On another note, a user reported that building Qt without support for the iconv library fixes the problem.
Comment 22 David Faure 2009-03-10 20:17:51 UTC
Reopening due to cases like gwenview (I guess there are others).
Comment 23 David Faure 2009-03-10 20:18:50 UTC
Created attachment 32007 [details]
Possible fix for gwenview

Does this patch fix gwenview? Thanks for testing.
Comment 24 Jonathan Thomas 2009-03-10 21:30:09 UTC
*** Bug 186798 has been marked as a duplicate of this bug. ***
Comment 25 Jonathan Thomas 2009-03-10 21:31:16 UTC
*** Bug 186793 has been marked as a duplicate of this bug. ***
Comment 26 Marian Kyral 2009-03-10 21:49:57 UTC
(In reply to comment #23)
> Created an attachment (id=32007) [details]
> Possible fix for gwenview
> 
> Does this patch fix gwenview? Thanks for testing.

Works correctly on Gentoo with gwenview from KDE 4.2.1.
Thanks for the patch.
Comment 27 David Faure 2009-03-11 01:23:56 UTC
Ah. But wait. Wrong patch.
It all works here in trunk without a gwenview-specific patch, but with a Qt-4.5-final patch in klocale (r934710) to make sure kdecore initializes the locale properly.
Let's see about backporting that one....
Yep, doable, as long as nobody uses 4.5-rc1, but only 4.4.x or 4.5.0.
Sorry, you get to test again ;)
  http://www.davidfaure.fr/kde/kcatalog.cpp.diff
(patch for kdelibs/kdecore/localization/kcatalog.cpp)
Don't forget to remove the gwenview-specific hack too. Thanks!
Comment 28 BerS 2009-03-11 09:44:36 UTC
Gentoo, x86_64, kde-4.2.1

Ok, for me with Russian charset utf8:
1. Recompile Qt with USE="-iconv" (kdelibs-4.2.1 without patch) and no
problems.
2. Upgrade to kdelibs-4.2.1-r1 (with patch for Gentoo, Qt with USE="-iconv") - no problems.
3. Recompile Qt with USE="+iconv" (kdelibs-4.2.1-r1) - Gwenview fail. :(
The latest patch (kcatalog.cpp.diff) I am not testing.
I returned to Qt with USE="-iconv".
Comment 29 David Faure 2009-03-11 14:05:28 UTC
Any testing that doesn't include the last patch is not really useful though, it's just a confirmation of what was already said and debugged before.
Comment 30 Marian Kyral 2009-03-11 14:47:31 UTC
Hi,
I just tested kdelibs patched by the two patches above and without the gwenview patch applied. Can confirm that kwrite, okular and gwenview works correctly.
Comment 31 Konstantin 2009-03-11 17:00:01 UTC
Also retest with this patches. Dolphin and Konqueror sent the names correctly, but in systemsettings encoding not fixed
Comment 32 Marian Kyral 2009-03-11 17:58:32 UTC
(In reply to comment #31)
> Also retest with this patches. Dolphin and Konqueror sent the names correctly,
> but in systemsettings encoding not fixed

Do you mean the title after systemsetting start?
Comment 33 Marian Kyral 2009-03-11 18:02:36 UTC
Created attachment 32033 [details]
System setting incorrect title after start.

It fix when click on the Advanced tab.
Comment 34 David Faure 2009-03-11 19:08:06 UTC
SVN commit 938370 by dfaure:

Backport the encoding fix for Qt-4.5.0 (r934710), adding a #if QT_VERSION >= 0x040500.
This breaks compilation with 4.5-rc1, but you're not supposed to use that anyway.
BUG: 186038


 M  +22 -7     kcatalog.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=938370
Comment 35 Konstantin 2009-03-12 11:20:38 UTC
yes< my result after start in 31999
Comment 36 Konstantin 2009-03-12 11:21:31 UTC
(id=31999)
Comment 37 Konstantin 2009-03-12 11:22:53 UTC
http://bugs.kde.org/attachment.cgi?id=31999 here is my issue (russian locale)
Comment 38 Pierre Schmitz 2009-03-12 12:36:57 UTC
Using KDE 4.2.1 with Qt 4.5.0 and the patches from commit 934640 and 938370 seems to solve the filename issue.

However, e.g. kdialog still has problems with utf8:

"kdialog --sorry äöüß" results in "äöüÃ"

"kdialog --sorry $(echo äöüß | iconv -f utf8 -t latin1)" in contrast does give the expected result.
Comment 39 Konstantin 2009-03-12 13:11:36 UTC
What about russian symbols? I remove patches:( And cannot retest it:( And can someone post this bug in QT bugziila?
Comment 40 David Faure 2009-03-12 16:45:25 UTC
SVN commit 938657 by dfaure:

Fix encoding bug, "kdialog --sorry ?\195?\169" or "kmail --subject ?\195?\169" would double-encode the chars, due to a bad QByteArray-to-QString conversion (regression from r931769). Fix will be in 4.2.2.
CCBUG: 186038


 M  +1 -1      kcmdlineargs.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=938657
Comment 41 David Faure 2009-03-12 16:53:23 UTC
Konstantin: 1) please calm down. 2) é or russian characters make no difference, same bug and same fix. 3) no need to bug Qt, the bug was in KDE, even though it came from a behavior change in Qt (and the last KCmdLineArgs fix was definitely a KDE bug); I discussed the matter with the involved Qt developer already.
Anyway, all fixed for 4.2.2.
Comment 42 Konstantin 2009-03-12 17:00:26 UTC
Sorry. Very thanks for paths. After 4.2.2 I no more need to use GNOME
Comment 43 Jonathan Thomas 2009-03-13 01:02:58 UTC
*** Bug 186930 has been marked as a duplicate of this bug. ***
Comment 44 David Faure 2009-03-14 12:58:38 UTC
You can also use File / Open meanwhile, no reason to switch to another desktop environment :-)
Comment 45 Pino Toscano 2009-03-14 16:04:35 UTC
*** Bug 187148 has been marked as a duplicate of this bug. ***
Comment 46 Pino Toscano 2009-03-17 20:23:01 UTC
*** Bug 187437 has been marked as a duplicate of this bug. ***
Comment 47 Pino Toscano 2009-03-18 11:04:05 UTC
*** Bug 187470 has been marked as a duplicate of this bug. ***
Comment 48 Pino Toscano 2009-03-21 10:16:48 UTC
*** Bug 187768 has been marked as a duplicate of this bug. ***
Comment 49 George Kiagiadakis 2009-03-24 00:50:04 UTC
I still have two issues with this wierd Qt 4.5 regression...
I use greek locale on my system, hence the following problems:

1) $kdeapp --help outputs the help text using questionmarks instead of greek symbols... :P
2) drkonqi has problem getting the name of the crashed application. For example, "Plasma desktop" is translated as "Χώρος εργασίας Plasma" and in drkonqi it appears as "ΧÏÏÎ¿Ï ÎµÏγαÏÎ¯Î±Ï Plasma".

testcase: $(kde4-config --path libexec)/drkonqi --signal 11 --appname plasma --appversion 1.0 --bugaddress submit@bugs.kde.org --programname "Χώρος εργασίας Plasma" --pid 0

For drkonqi, the problem seems to be that argument parsing and conversion to QString happens before QApplication is constructed (and I have changed this in the work branch of drkonqi), but I don't understand why should this be required now if it used to work with Qt 4.4...
Comment 50 David Faure 2009-03-24 01:18:32 UTC
George: your testcase works fine for me, in both 4.2-branch and trunk. You didn't mention which version of kdelibs you were using...
Comment 51 Pino Toscano 2009-03-24 17:08:56 UTC
*** Bug 188012 has been marked as a duplicate of this bug. ***
Comment 52 George Kiagiadakis 2009-03-25 00:40:04 UTC
(In reply to comment #50)
> George: your testcase works fine for me, in both 4.2-branch and trunk. You
> didn't mention which version of kdelibs you were using...

Ok sorry, it was my fault. I am using the debian 4.2.1 packages, which include the patches that you made on the 4.2 branch, however it seems that kdelibs needs to be rebuilt with Qt 4.5 in order to work properly. Rebuilding the package fixes the problem for me. I can't say I like this solution, but I guess I'll have to live with it...
Comment 53 Javier Jardon 2009-03-25 19:20:39 UTC
*** Bug 188052 has been marked as a duplicate of this bug. ***
Comment 54 Dmitrij S. Kryzhevich 2009-03-27 13:17:30 UTC
*** Bug 185222 has been marked as a duplicate of this bug. ***
Comment 55 Matija Šuklje 2009-03-28 14:24:08 UTC
*** Bug 184261 has been marked as a duplicate of this bug. ***
Comment 56 Oleg Terehov 2009-04-02 20:02:52 UTC
kde 4.2.2 Suse factory. Gwenview could not open file with non latin symbols in the path. The bug is not fixed.
Comment 57 David Faure 2009-04-02 20:50:38 UTC
Olegator: Qt version?

And more tricky question: which Qt version was kdelibs compiled against....
Compiling against Qt-4.4 and then upgrading to Qt-4.5 won't work, the fix is done at compile time if Qt-4.5 is detected...
Comment 58 Oleg Terehov 2009-04-03 05:24:17 UTC
(In reply to comment #57)
> Olegator: Qt version?
> 
> And more tricky question: which Qt version was kdelibs compiled against....
> Compiling against Qt-4.4 and then upgrading to Qt-4.5 won't work, the fix is
> done at compile time if Qt-4.5 is detected...

Qt 4.5.0-43.1. But I do not know as the package has been compiled in the Suse Factory repository. Thanks.
Comment 59 Konstantin 2009-04-03 09:23:06 UTC
I have som issue also in Ark with non-latin UTF-8 characters (KDE 4.2.2 QT 4.5). See bug 187201. I think this is not fixed part of this
Comment 60 Danila Sentiabov 2009-04-03 10:33:35 UTC
I can confirm that bug is still not fixed fully in 4.2.2, at least in openSUSE builds.
Kwrite and Okular now open files OK for me, but the file with non-English characters in its name still can't be opened with Gwenview and dragging-n-dropping of such a file to KMail message window doesn't work either (manual opening and attaching in Gwenview and KMail respectively still works via main menu or toolbar items).
Comment 61 Marian Kyral 2009-04-03 10:36:31 UTC
KDE 4.2.2/Qt 4.5.0 on Gentoo without patches from 4.2.1 works correctly.

No problem with kate, gwenview.
Comment 62 Marian Kyral 2009-04-03 10:50:48 UTC
(In reply to comment #60)
> dragging-n-dropping of such a file to KMail message window doesn't work either

I just tested. No problem to DnD file "hlavička.png" to gwenview.
Comment 63 Will Stephenson 2009-04-03 17:51:26 UTC
openSUSE person reporting:

This bug is a problem with openSUSE < 11.2 (Factory) and KDE 4.2.x packages only when Qt 4.5 is installed. 

This is because the extra initialisation added by David in 938370 is only used if the packages are built with Qt 4.5.  Our 11.1 and earlier packages are built with and intended for use with Qt 4.4, so when the KDE:Qt repo to get Qt 4.5, the initialisation does not take place.

I've just added a patch to our 4.2.2 packages that performs the version check at runtime.
Comment 64 Will Stephenson 2009-04-03 17:53:09 UTC
Created attachment 32572 [details]
linux-specific qt version check

In case anyone else wants this.
Comment 65 David Faure 2009-04-03 18:00:16 UTC
Nice fix, thanks Will!  (Can you inform kde-packager about this fix?)
Comment 66 Oleg Terehov 2009-04-04 15:03:40 UTC
The bug was corrected after a last update from opensuse 11.1 factory
Comment 67 Aurelien Gateau 2009-04-15 23:06:51 UTC
*** Bug 187855 has been marked as a duplicate of this bug. ***
Comment 68 Aurelien Gateau 2009-04-27 15:56:36 UTC
*** Bug 188746 has been marked as a duplicate of this bug. ***
Comment 69 Aurelien Gateau 2009-04-27 15:57:38 UTC
*** Bug 188369 has been marked as a duplicate of this bug. ***
Comment 70 Peter Penz 2009-04-30 12:59:01 UTC
*** Bug 167458 has been marked as a duplicate of this bug. ***
Comment 71 Thomas Capricelli 2009-04-30 14:18:48 UTC
hi.
i'm a little bit lost with the opensuse stuff. For those not using opensuse, is it fixed ? in which version of kde ? Will 4.2.3 have it ?
Comment 72 Will Stephenson 2009-04-30 15:05:14 UTC
In openSUSE it's fixed in our 4.2 repositories (KDE:42, KDE:KDE4:Factory and openSUSE:Factory) so that it works if you install Qt 4.5 with KDE packages built with Qt 4.4.  The mail was forwarded onto the packagers' mailing list but there wasn't any discussion which distros have integrated it.  If KDE 4.2.3 packages are built with Qt 4.5 and run with Qt 4.5 there won't be an issue.
Comment 73 Fathi Boudra 2009-04-30 19:32:22 UTC
It's fixed also on Debian packages (KDE 4.2.2-1)