Bug 201070 - fail to encrypt file whose path contains non-ascii characters - Patch proposed
Summary: fail to encrypt file whose path contains non-ascii characters - Patch proposed
Status: RESOLVED FIXED
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Rolf Eike Beer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-22 08:49 UTC by gouzhuang
Modified: 2009-09-29 23:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch (3.18 KB, patch)
2009-07-22 09:03 UTC, gouzhuang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gouzhuang 2009-07-22 08:49:43 UTC
Version:           2.1.0 (using 4.2.4 (KDE 4.2.4), Kubuntu packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.28-14-generic

when trying to encrypt a file from Dolphin context menu, if there are Chinese characters in the path(e.g.: /home/user/文档/test.txt), the encryption will fail with the following popup error message:

Process halted.
Not all files were encrypted.

My locale is zh_CN.UTF-8, and my filesystem encoding is UTF-8.

I read the source code and thought the path was not encoded correctly when passing to the gpg program. I have made a patch and it works for me. I'll put the patch in attachment.
Comment 1 gouzhuang 2009-07-22 09:03:31 UTC
Created attachment 35527 [details]
Proposed patch

removed all unnecessary QFile::encodeName() calls. As QFile::encodeName() converts a unicode string to local encoding, however when the resulting QByteArray is passed to KProcess, it is converted back to unicode. if the QFile::setEncodingFunction() was called with a encoder other the default, the final unicode string may not be the same as original.
Comment 2 Rolf Eike Beer 2009-07-23 00:28:13 UTC
Thanks for the patch. I'll test it in the next days.
Comment 3 Rolf Eike Beer 2009-09-29 23:40:33 UTC
SVN commit 1029477 by dakon:

don't use QFile::encodeName() for strings that are passed as KProcess options

Patch provided by gouzhuang(.)gmail.com. Sorry for the delay.

BUG:201070

 M  +13 -19    kgpgtextinterface.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1029477