From orice at secarica.ro Wed May 2 14:32:55 2007 From: orice at secarica.ro (Cristian =?ISO-8859-2?Q?Secar=E3?=) Date: Wed, 2 May 2007 15:32:55 +0300 Subject: utf-8 character is displayed badly in GPA interface (Win32) Message-ID: <20070502153255.a4580c25.orice@secarica.ro> The GPA interface displays badly the utf-8 component from my name. This is how it looks like: http://www.secarica.ro/misc/gpa_bad_utf8_display_noted.png It does not matter if the key is generated using the gpg --key-gen command, or via GPA interface. However, the gpg --list-keys displays correctly the ? character. Is there a problem with the GPA ? I am using the precompiled version included in gpg4win package. The system is set to Romanian locale. At the same time, all Romanian characters included in the interface are being displayed well, except a (known) issue with the toolbar title in GTK+ for Win32 version, where a Unicode character that does not exist in any CP-12xx makes the toolbar tile to appear blank. Cristi From bernhard at intevation.de Wed May 2 17:27:47 2007 From: bernhard at intevation.de (Bernhard Reiter) Date: Wed, 2 May 2007 17:27:47 +0200 Subject: utf-8 character is displayed badly in GPA interface (Win32) In-Reply-To: <20070502153255.a4580c25.orice@secarica.ro> References: <20070502153255.a4580c25.orice@secarica.ro> Message-ID: <200705021727.51576.bernhard@intevation.de> Hi Cristian, On Wednesday 02 May 2007 14:32, Cristian Secar? wrote: > The GPA interface displays badly the utf-8 component from my name. > This is how it looks like: > http://www.secarica.ro/misc/gpa_bad_utf8_display_noted.png > > It does not matter if the key is generated using the gpg --key-gen > command, or via GPA interface. However, the gpg --list-keys displays > correctly the ? character. > > Is there a problem with the GPA ? it seems like it, though it could also be a problem of gpg itself. > I am using the precompiled version included in gpg4win package. The > system is set to Romanian locale. > At the same time, all Romanian characters included in the interface are > being displayed well, except a (known) issue with the toolbar title in > GTK+ for Win32 version, where a Unicode character that does not exist in > any CP-12xx makes the toolbar tile to appear blank. Thanks for the good problem report, can you check https://bugs.g10code.com/gnupg/issue?%40search_text=&title=&%40columns=title&category=6&version=&topic=&id=&%40columns=id&creation=&duedate=&activity=&%40columns=activity&%40sort=activity&priority=&%40group=priority&status=&%40columns=status&%40sortdir=on&%40action=search and add your information, that is most convenient for developers. Thanks, Bernhard -- Managing Director - Owner: www.intevation.net (Free Software Company) Germany Coordinator: fsfeurope.org. Coordinator: www.Kolab-Konsortium.com. Intevation GmbH, Osnabr?ck, DE; Amtsgericht Osnabr?ck, HRB 18998 Gesch?ftsf?hrer Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : /pipermail/attachments/20070502/0cbe092d/attachment.pgp From wk at gnupg.org Wed May 2 19:30:51 2007 From: wk at gnupg.org (Werner Koch) Date: Wed, 02 May 2007 19:30:51 +0200 Subject: utf-8 character is displayed badly in GPA interface (Win32) In-Reply-To: <20070502153255.a4580c25.orice@secarica.ro> ("Cristian =?utf-8?Q?Secar=C4=83=22's?= message of "Wed\, 2 May 2007 15\:32\:55 +0300") References: <20070502153255.a4580c25.orice@secarica.ro> Message-ID: <87wszrgmk4.fsf@wheatstone.g10code.de> On Wed, 2 May 2007 14:32, orice at secarica.ro said: > Is there a problem with the GPA ? Yes, it is due to this simple heuristics: /* Make sure the encoding is UTF-8. Test structure suggested by Werner Koch. */ for (s = string; *s && !(*s & 0x80); s++) ; if (*s && !strchr (string, 0xc3)) { /* The string is Latin-1. */ return g_convert (string, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); } else { /* The string is already in UTF-8. */ return g_strdup (string); } Obviously this is not correct. Your name is correctly utf-8 encoded as "Cristian Secar\xc4\x83". The above code will falsely assume that this is Latin-1 one and converts the string to utf-8. The code works for the French an German characters but obviously not tested with other character sets. The hack is required because PGP has a long standing bug which did not do any conversion and stored names verbatim. Most systems at that time used Latin-1 so German and other folks got their Umlauts (e.g. M?ller) wrong. The problem is that an utf-8 strings may also be a valid Latin-1 string. Most names would look strange, though. I will change the test to take the continuation bytes in account. Shalom-Salam, Werner From wk at gnupg.org Wed May 2 21:07:01 2007 From: wk at gnupg.org (Werner Koch) Date: Wed, 02 May 2007 21:07:01 +0200 Subject: utf-8 character is displayed badly in GPA interface (Win32) In-Reply-To: <20070502153255.a4580c25.orice@secarica.ro> ("Cristian =?utf-8?Q?Secar=C4=83=22's?= message of "Wed\, 2 May 2007 15\:32\:55 +0300") References: <20070502153255.a4580c25.orice@secarica.ro> Message-ID: <87odl3gi3u.fsf@wheatstone.g10code.de> Hi! Please try the SVN version of GPA or use the patch below. Salam-Shalom, Werner --- src/gpgmetools.c (revision 774) +++ src/gpgmetools.c (working copy) @@ -729,24 +729,41 @@ static gchar * string_to_utf8 (const gchar *string) { - const gchar *s; - + const char *s; + if (!string) - { - return NULL; - } - /* Make sure the encoding is UTF-8. Test structure suggested by - Werner Koch. */ + return NULL; + + /* Due to a bug in old and not so old PGP versions user IDs have + been copied verbatim into the key. Thus many users with Umlauts + et al. in their name will see their names garbled. Although this + is not an issue for me (;-)), I have a couple of friends with + Umlauts in their name, so let's try to make their life easier by + detecting invalid encodings and convert that to Latin-1. */ for (s = string; *s && !(*s & 0x80); s++) ; - if (*s && !strchr (string, 0xc3)) + if (*s && ((s[1] & 0xc0) == 0x80) && ( ((*s & 0xe0) == 0xc0) + || ((*s & 0xf0) == 0xe0) + || ((*s & 0xf8) == 0xf0) + || ((*s & 0xfc) == 0xf8) + || ((*s & 0xfe) == 0xfc)) ) + { + /* Possible utf-8 character followed by continuation byte. + Although this might still be Latin-1 we better assume that it + is valid utf-8. */ + return g_strdup (string); + } + else if (*s && !strchr (string, 0xc3)) { - /* The string is Latin-1. */ - return g_convert (string, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); + /* No 0xC3 character in the string; assume that it is Latin-1. */ + return g_convert (string, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); } else { - /* The string is already in UTF-8. */ + /* Everything else is assumed to be UTF-8. We do this even that + we know the encoding is not valid. However as we only test + the first non-ascii character, valid encodings might + follow. */ return g_strdup (string); } } From orice at secarica.ro Wed May 2 22:47:53 2007 From: orice at secarica.ro (Cristian =?ISO-8859-2?Q?Secar=E3?=) Date: Wed, 2 May 2007 23:47:53 +0300 Subject: utf-8 character is displayed badly in GPA interface (Win32) In-Reply-To: <87odl3gi3u.fsf@wheatstone.g10code.de> References: <20070502153255.a4580c25.orice@secarica.ro> <87odl3gi3u.fsf@wheatstone.g10code.de> Message-ID: <20070502234754.33d31202.orice@secarica.ro> On Wed, 02 May 2007 21:07:01 +0200, Werner Koch wrote: > Please try the SVN version of GPA or use the patch below. Thank you, I will try to do so, except that I don't know how quick that will be. I will post the result on this list. I will also make some other experiments with random common person names from my language that contains language specific characters. Cristi From orice at secarica.ro Wed May 30 01:17:29 2007 From: orice at secarica.ro (Cristian =?ISO-8859-2?Q?Secar=E3?=) Date: Wed, 30 May 2007 02:17:29 +0300 Subject: incorrect GPA decription on binary compressed signature Message-ID: <20070530021729.cfc3e9ef.orice@secarica.ro> There is something weird with the GPA file feature for decrypting signed and compressed signature files. I have taken a small .gif file and signed it, using the first (default) signature option. The .gpg file is generated ok. Now, when dropping back this file in the GPA interface (file mode), by hitting the Decrypt button, an error appears telling me that the gpg file contains no OpenGPG data. The original .gif file (which I deleted previously, leaving only the .gpg file) appears temporarely until I close the error box, so the program seems to try to extract it, but the picture is partially broken (I open it before it disapears, i.e. before closing the error box). The generated .gpg signature file is ok, because I can decrypt it and extract the .gif file very well using either GPGee explorer extension or WinPT tray application. I'm on WinXP, GPA is 0.7.6 from the latest gpg4win package. Hm ? Cristi -- Cristian Secar? http://www.secarica.ro/ From orice at secarica.ro Wed May 30 01:17:29 2007 From: orice at secarica.ro (Cristian =?ISO-8859-2?Q?Secar=E3?=) Date: Wed, 30 May 2007 02:17:29 +0300 Subject: incorrect GPA decription on binary compressed signature Message-ID: <20070530021729.cfc3e9ef.orice@secarica.ro> There is something weird with the GPA file feature for decrypting signed and compressed signature files. I have taken a small .gif file and signed it, using the first (default) signature option. The .gpg file is generated ok. Now, when dropping back this file in the GPA interface (file mode), by hitting the Decrypt button, an error appears telling me that the gpg file contains no OpenGPG data. The original .gif file (which I deleted previously, leaving only the .gpg file) appears temporarely until I close the error box, so the program seems to try to extract it, but the picture is partially broken (I open it before it disapears, i.e. before closing the error box). The generated .gpg signature file is ok, because I can decrypt it and extract the .gif file very well using either GPGee explorer extension or WinPT tray application. I'm on WinXP, GPA is 0.7.6 from the latest gpg4win package. Hm ? Cristi -- Cristian Secar? http://www.secarica.ro/