Bug 139276 - Kgpg cannot see unicode encoded names right
Summary: Kgpg cannot see unicode encoded names right
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:
: 144368 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-27 15:57 UTC by Serge Polkovnikov
Modified: 2007-09-11 09:35 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proof (55.53 KB, image/png)
2007-02-06 22:08 UTC, Non_E
Details
screenshot, mojibake in names (2.92 KB, image/png)
2007-06-01 05:45 UTC, Lars DIECKOW
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Polkovnikov 2006-12-27 15:57:17 UTC
Version:           1.2.2 (using KDE KDE 3.5.5)
Installed from:    Unlisted Binary Package
Compiler:          gcc4.1 

See bug #62840 (status RESOLVED)
https://bugs.kde.org/show_bug.cgi?id=62840
Comment 1 Non_E 2007-02-06 22:08:45 UTC
Created attachment 19570 [details]
Proof

I confirm this bug on KDE 3.5.6/Gentoo.
Comment 2 Olivier Vitrat 2007-03-12 16:21:04 UTC
Also reported in Debian BTS at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=385778
Comment 3 Lars DIECKOW 2007-06-01 05:45:29 UTC
Created attachment 20751 [details]
screenshot, mojibake in names

Confirmed for KGpg 1.2.2, using package kdeutils3-3.5.7-3.3 from openSUSE 10.2.
Unicode handling is messed up big-time.
Comment 4 Rolf Eike Beer 2007-08-13 16:38:36 UTC
*** Bug 144368 has been marked as a duplicate of this bug. ***
Comment 5 Rolf Eike Beer 2007-09-11 09:35:28 UTC
SVN commit 711018 by dakon:

Fix the display of GnuPG encoded UTF8

GnuPG recodes some UTF8 characters as \xnn (where nn are hex numbers). When 
this happens to one of character of a multibyte entity (e.g. one of the bytes 
of a german umlaut) the display of this string is destroyed. We receive the 
data from K3ProcIO which does the transition from QByteArray to QString. 
QString then does UTF8 recoding, finds an invalid entity and overwrites it. 
Now you can't get the correct display even if you recode the \xnn to the 
original value.

Since I can't change K3ProcIO I copied it and modified it to do the \xnn
recoding before the translation to QString.

BUG:139276


 M  +1 -0      CMakeLists.txt  
 A             gpgproc.cpp   [License: LGPL (v2)]
 A             gpgproc.h   [License: LGPL (v2)]
 M  +10 -8     kgpginterface.cpp  
 M  +3 -2      kgpginterface.h  


--- trunk/KDE/kdeutils/kgpg/CMakeLists.txt #711017:711018
@@ -25,6 +25,7 @@
    main.cpp
    kgpgkeygenerate.cpp
    kgpginterface.cpp
+   gpgproc.cpp
    keyservers.cpp
    kgpgeditor.cpp
    detailedconsole.cpp
--- trunk/KDE/kdeutils/kgpg/kgpginterface.cpp #711017:711018
@@ -40,6 +40,7 @@
 #include "detailedconsole.h"
 #include "kgpgsettings.h"
 #include "core/convert.h"
+#include "gpgproc.h"
 
 using namespace KgpgCore;
 
@@ -397,9 +398,11 @@
     m_numberid = 1;
     cycle = "none";
 
-    K3ProcIO *process = gpgProc(2, 0);
+    GPGProc *process = new GPGProc();
+    *process << "--status-fd=2" << "--command-fd=0";
+
     process->setParent(this);
-    *process << "--with-colon" << "--with-fingerprint";
+    *process << "--with-fingerprint";
     if (!withsigs)
         *process << "--list-keys";
     else
@@ -411,7 +414,7 @@
     if (!block)
     {
         kDebug(2100) << "(KgpgInterface::readPublicKeys) Extract public keys with K3Process::NotifyOnExit" ;
-        connect(process, SIGNAL(readReady(K3ProcIO *)), this, SLOT(readPublicKeysProcess(K3ProcIO *)));
+        connect(process, SIGNAL(readReady(K3ProcIO *)), this, SLOT(readPublicKeysProcess(GPGProc *)));
         connect(process, SIGNAL(processExited(K3Process *)), this, SLOT(readPublicKeysFin(K3Process *)));
         process->start(K3Process::NotifyOnExit, false);
         emit readPublicKeysStarted(this);
@@ -427,7 +430,7 @@
     }
 }
 
-void KgpgInterface::readPublicKeysProcess(K3ProcIO *p)
+void KgpgInterface::readPublicKeysProcess(GPGProc *p)
 {
     QString line;
     bool partial = false;
@@ -732,9 +735,8 @@
     m_secretkey = KgpgKey();
     m_secretactivate = false;
 
-    K3ProcIO *process = gpgProc(2, 0);
-    process->setParent(this);
-    *process << "--with-colon" << "--list-secret-keys";
+        GPGProc *process = new GPGProc();
+        *process << "--status-fd=2" << "--command-fd=0" << "--list-secret-keys";
 
         *process << ids;
 
@@ -749,7 +751,7 @@
         return m_secretlistkeys;
 }
 
-void KgpgInterface::readSecretKeysProcess(K3ProcIO *p)
+void KgpgInterface::readSecretKeysProcess(GPGProc *p)
 {
     QString line;
     bool partial = false;
--- trunk/KDE/kdeutils/kgpg/kgpginterface.h #711017:711018
@@ -29,6 +29,7 @@
 class KTemporaryFile;
 class K3Process;
 class K3ProcIO;
+class GPGProc;
 
 /**
  * This class is the interface for gpg.
@@ -94,7 +95,7 @@
     KgpgCore::KgpgKeyList readPublicKeys(const bool &block = false, const QStringList &ids = QStringList(), const bool &withsigs = false);
 
 private slots:
-    void readPublicKeysProcess(K3ProcIO *p);
+    void readPublicKeysProcess(GPGProc *p);
     void readPublicKeysFin(K3Process *p, const bool &block = false);
 
 private:
@@ -111,7 +112,7 @@
     KgpgCore::KgpgKeyList readSecretKeys(const QStringList &ids = QStringList());
 
 private slots:
-    void readSecretKeysProcess(K3ProcIO *p);
+    void readSecretKeysProcess(GPGProc *p);
 
 private:
     bool m_secretactivate;