GnuPG 2.0 vs. 1.4 locale; gpgme_set_locale

Albrecht Dreß albrecht.dress at
Sat Nov 25 17:46:13 CET 2006

Hi all,

I have two related questions regarding the locale treatment in gnupg and  

After upgrading from gnupg 1.4 to 2.0 I noticed that the behaviour of  
passing strings to pinentry changed if I e.g. just type "gpg --sign" on  
the terminal.  The following table lists the locale settings, the encoding  
of the strings printed on the terminal and the encoding of the strings  
passed to pinentry:

Application | terminal locale  | terminal output  | pinentry strings
gnupg 1.4   | de_DE.ISO-8859-1 | de_DE.ISO-8859-1 | *de_DE.UTF-8*
gnupg 1.4   | de_DE.UTF-8      | de_DE.UTF-8      | de_DE.UTF-8
gnupg 2.0   | de_DE.ISO-8859-1 | de_DE.ISO-8859-1 | *de_DE.ISO-8859-1*
gnupg 2.0   | de_DE.UTF-8      | de_DE.UTF-8      | de_DE.UTF-8

Both versions use the agent and the Gtk+-2.0 pinentry version.  As my  
environment is still set to latin1, pinentry gets confused if it gets a  
string containing /mixed/ character sets where the message is in latin1  
("Sie benötigen eine Passphrase...), but the description of my key  
("Albrecht Dreß") is in utf-8.  Launching the agent with LC_ALL set to  
de_DE.UTF-8 makes things even worse as it calls pinentry with this  
setting, and then pinentry has no clue how it should call iconv to convert  
the latin1 string properly.

Shouldn't the conversation between gnupg and the agent always be in utf-8?  
If not, gnupg /must/ ensure that the strings contain characters from only  
/one/ encoding.  However, IMHO exclusively using utf-8 is the better  
solution as key descriptions may contain characters from any codeset.

The second question is how gpgme treats gpgme_set_locale() when I call the  
gnupg backend.  I mainly use gpg through the Gnome MUA balsa, which talks  
to gnupg through gpgme.  In balsa, I tried to explicitly set a gpgme utf-8  
locale, but apparently this setting isn't fed through to gpg, i.e. it  
still runs with my "normal" (Latin-1) environment.  A quick glance over  
the source shows that (in posix-io.c) a execv() call is used instead of  
execve().  How are the locales set in gpgme are supposed to work?

Cheers, Albrecht.

  Albrecht Dreß  -  Johanna-Kirchner-Straße 13  -  D-53123 Bonn (Germany)
        Phone (+49) 228 6199571  -  mailto:albrecht.dress at
   GnuPG public key:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/attachments/20061125/a9763fce/attachment.pgp

More information about the Gnupg-devel mailing list