PATCH -- GnuPG 1.2.1 UTF8 output

Matthias Posseldt matthi at gmx.li
Sun Feb 9 12:43:01 CET 2003


Package: gnupg
Version: 1.2.1

Hello,

the KGPG developers realized that there seems to be a bug related to UTF8 
output. According to the manual, --with-colons ever prints out information 
in UTF8 encoding regardless of --no-utf8-strings.

But it does always output as non-UTF8 string. I don't have any 
configuration settings in my gpg.conf (besides a uncommented keyserver ... 
line).

Here is an example:

$$ gpg --list-keys --with-colons
pub:-:1024:17:9749E1C28CB749A6:2003-01-24:::-:coüxx <12 at 23.lo>::scESC:
[This should be coüxx, co<U-Umlaut>xx, not garbage]
sub:-:1024:16:B4A623324A77464F:2003-01-24::::::e:
pub:-:1024:17:8E8E15149961AF82:1998-12-10:::-:Frédéric Muller 
<fred at madtec.com>::scESC:
sub:-:2048:16:7573D0A4101F48BB:1998-12-10::::::e:

$$ gpg --list-keys --utf8-strings
pub  1024D/8CB749A6 2003-01-24 coüxx <12 at 23.lo>
sub  1024g/4A77464F 2003-01-24

pub  1024D/9961AF82 1998-12-10 Fr\xe9\x64\xe9\x72ic Muller 
<fred at madtec.com>
sub  2048g/101F48BB 1998-12-10

Thus, I looked into the code and found out that the corresponding function 
list_keyblock_colon() calls print_string() to print the name and e-mail 
address, but (to my understanding) it should print via 
print_utf8_string2().

Thus, I created a small patch that corrects the problem with Umlauts and 
other special characters.

A different problem is shown with the output above, it should show Frederic 
(with a ´ over both 'e'), but I don't know the reason for that.

Ciao, Matthias

diff -ur gnupg-1.2.1-old/g10/keylist.c gnupg-1.2.1/g10/keylist.c
--- gnupg-1.2.1-old/g10/keylist.c       2002-10-12 13:39:35.000000000 +0200
+++ gnupg-1.2.1/g10/keylist.c   2003-01-29 19:24:13.000000000 +0100
@@ -733,7 +733,7 @@
                     node->pkt->pkt.user_id->numattribs,
                     node->pkt->pkt.user_id->attrib_len);
             else
-             print_string( stdout,  node->pkt->pkt.user_id->name,
+             print_utf8_string2( stdout,  node->pkt->pkt.user_id->name,
                            node->pkt->pkt.user_id->len, ':' );
             putchar(':');
            if (any)
@@ -890,7 +890,7 @@
            else if ( !opt.fast_list_mode ) {
                size_t n;
                char *p = get_user_id( sig->keyid, &n );
-                print_string( stdout, p, n, ':' );
+                print_utf8_string2( stdout, p, n, ':' );
                m_free(p);
            }
             printf(":%02x%c:\n", 
sig->sig_class,sig->flags.exportable?'x':'l');





More information about the Gnupg-devel mailing list