summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2007-10-19 17:58:38 +0200
committerWerner Koch <wk@gnupg.org>2007-10-19 17:58:38 +0200
commitc12ce55b25685738bc1668df7b7bde87c4ba023c (patch)
treea863f6912c1d113edc361ee47d69e3135fe703b0 /tools
parentEnhanced gpg-conect-agent scripting. (diff)
downloadgnupg2-c12ce55b25685738bc1668df7b7bde87c4ba023c.tar.xz
gnupg2-c12ce55b25685738bc1668df7b7bde87c4ba023c.zip
Factored utf8 switching code out to i18n.c.
Diffstat (limited to 'tools')
-rw-r--r--tools/ChangeLog2
-rw-r--r--tools/symcryptrun.c35
2 files changed, 5 insertions, 32 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog
index 118a0fe12..9d34e7d62 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,5 +1,7 @@
2007-10-19 Werner Koch <wk@g10code.com>
+ * symcryptrun.c (confucius_get_pass): Use utf8 switching functions.
+
* gpg-connect-agent.c (get_var_ext): New.
(substitute_line): Use it.
(assign_variable): Implement /slet in terms of get_var_ext.
diff --git a/tools/symcryptrun.c b/tools/symcryptrun.c
index fced86fb7..e720eab2f 100644
--- a/tools/symcryptrun.c
+++ b/tools/symcryptrun.c
@@ -424,46 +424,17 @@ confucius_get_pass (const char *cacheid, int again, int *canceled)
{
int err;
char *pw;
-#ifdef ENABLE_NLS
- char *orig_codeset = NULL;
-#endif
+ char *orig_codeset;
if (canceled)
*canceled = 0;
-#ifdef ENABLE_NLS
- /* The Assuan agent protocol requires us to transmit utf-8 strings */
- orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL);
-#ifdef HAVE_LANGINFO_CODESET
- if (!orig_codeset)
- orig_codeset = nl_langinfo (CODESET);
-#endif
- if (orig_codeset && !strcmp (orig_codeset, "UTF-8"))
- orig_codeset = NULL;
- if (orig_codeset)
- {
- /* We only switch when we are able to restore the codeset later. */
- orig_codeset = xstrdup (orig_codeset);
- if (!bind_textdomain_codeset (PACKAGE_GT, "utf-8"))
- {
- xfree (orig_codeset);
- orig_codeset = NULL;
- }
- }
-#endif
-
+ orig_codeset = i18n_switchto_utf8 ();
pw = simple_pwquery (cacheid,
again ? _("does not match - try again"):NULL,
_("Passphrase:"), NULL, 0, &err);
err = map_spwq_error (err);
-
-#ifdef ENABLE_NLS
- if (orig_codeset)
- {
- bind_textdomain_codeset (PACKAGE_GT, orig_codeset);
- xfree (orig_codeset);
- }
-#endif
+ i18n_switchback (orig_codeset);
if (!pw)
{