gpgme key key listing issues
Werner Koch
wk@gnupg.org
Mon Sep 9 18:11:01 2002
On Mon, 9 Sep 2002 10:32:24 -0400, Gordon Worley said:
> Is there a simple test to see if the text has any encoding mismatches?
> For example, some encoding schemes that have been used in PGP keys
> will cause Mac GPG Keys to crash upon trying to display them (this
> mostly happens with names from North European countries like Germany,
> Denmark, Norway, Sweden, etc.).
Here are two keys:
pub 1024R/FCF20B7D 1994-03-22 Ulf M\xf6\x6cler <ulf@fitug.de>
pub 1024D/817C3568 2001-11-20 Lars Marowsky-Brée (lmb) <lars@marowsky-bree.de>
Ulf's key is an old PGP 2 code and thus wrongly Latin-1 encoded. 0xf6
is an o-umlaut, the 0x6c is just the 'l' but the parser assumes it is
utf-8.
Lars' key is correctly OpenPGP encoded; the e-acute has the UTF-8
encoding 0xc3,0xa9 and the Latin-1 0xe9.
Here is a short list of commonly used characters:
Latin-1 UTF-8 Char
------------------------
E4 C3 A4 ä
F6 C3 B6 ö
FC C3 BC ü
C4 C3 84 Ä
D6 C3 96 Ö
DC C3 9C Ü
DF C3 9F ß
E9 C3 A9 é
E8 C3 A8 è
E1 C3 A1 á
E0 C3 A0 à
The 0xC3 is the A-tilde (Ã) in Latin-1 which is less used than the
other characters I believe. A simple approach might be:
for (s=string; *s && !(*s & 0x80); s++)
;
if (*s && !strchr (string, 0xc3))
display_latin_1 (string);
else
display_utf-8 (string);
If it would only be a PGP 2 problem we could fix this in GnuPG by
looking at the type of the key and the signature to figure out whether
it is OpenPGP. But most keys are created with PGP (or the recent GPA)
and thus we would need to apply heuristics for all keys - I don't
think this is a good idea. So lets try to fix it in the GUI display.
Shalom-Salam,
Werner