Группа :: Работа с файлами
Пакет: gnupg
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: gnupg-1.4.1-alt-getkey.patch
--- gnupg-1.4.1/g10/getkey.c.orig 2005-02-05 03:00:35 +0300
+++ gnupg-1.4.1/g10/getkey.c 2005-03-17 17:00:07 +0300
@@ -25,6 +25,11 @@
#include <string.h>
#include <assert.h>
#include <ctype.h>
+
+#ifdef HAVE_LANGINFO_CODESET
+#include <langinfo.h>
+#endif
+
#include "util.h"
#include "packet.h"
#include "memory.h"
@@ -161,6 +166,41 @@ cache_public_key( PKT_public_key *pk )
}
+static const char *
+get_user_id_not_found_msg (void)
+{
+ const char *retval;
+ char *orig_codeset = NULL;
+
+#ifdef ENABLE_NLS
+ orig_codeset = bind_textdomain_codeset (PACKAGE, NULL);
+#ifdef HAVE_LANGINFO_CODESET
+ if (!orig_codeset)
+ orig_codeset = nl_langinfo (CODESET);
+#endif
+ if (orig_codeset)
+ {
+ orig_codeset = m_strdup (orig_codeset);
+ if (!bind_textdomain_codeset (PACKAGE, "utf-8"))
+ {
+ m_free (orig_codeset);
+ orig_codeset = NULL;
+ }
+ }
+#endif
+
+ retval = _("[User ID not found]");
+
+#ifdef ENABLE_NLS
+ if (orig_codeset)
+ bind_textdomain_codeset (PACKAGE, orig_codeset);
+#endif
+ m_free (orig_codeset);
+
+ return retval;
+}
+
+
/*
* Return the user ID from the given keyblock.
* We use the primary uid flag which has been set by the merge_selfsigs
@@ -181,9 +221,7 @@ get_primary_uid ( KBNODE keyblock, size_
return k->pkt->pkt.user_id->name;
}
}
- /* fixme: returning translatable constants instead of a user ID is
- * not good because they are probably not utf-8 encoded. */
- s = _("[User ID not found]");
+ s = get_user_id_not_found_msg ();
*uidlen = strlen (s);
return s;
}
@@ -2747,7 +2785,7 @@ get_user_id( u32 *keyid, size_t *rn )
}
}
} while( ++pass < 2 && !get_pubkey( NULL, keyid ) );
- p = m_strdup( _("[User ID not found]") );
+ p = m_strdup( get_user_id_not_found_msg() );
*rn = strlen(p);
return p;
}