summaryrefslogtreecommitdiffstats
path: root/agent/protect-tool.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/protect-tool.c')
-rw-r--r--agent/protect-tool.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index 0e062a230..910ba036d 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -1171,38 +1171,16 @@ get_passphrase (int promptno, int opt_check)
char *pw;
int err;
const char *desc;
-#ifdef ENABLE_NLS
- char *orig_codeset = NULL;
-#endif
+ char *orig_codeset;
int error_msgno;
-
if (opt_passphrase)
return xstrdup (opt_passphrase);
error_msgno = promptno / 100;
promptno %= 100;
-#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 ();
if (promptno == 1 && opt_prompt)
desc = opt_prompt;
@@ -1226,13 +1204,7 @@ get_passphrase (int promptno, int opt_check)
_("Passphrase:"), desc, opt_check, &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)
{