1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Factored utf8 switching code out to i18n.c.

This commit is contained in:
Werner Koch 2007-10-19 15:58:38 +00:00
parent 259a40c830
commit c12ce55b25
12 changed files with 107 additions and 184 deletions

View file

@ -1,3 +1,7 @@
2007-10-19 Werner Koch <wk@g10code.com>
* protect-tool.c (get_passphrase): Use new utf8 switch fucntions.
2007-10-15 Daiki Ueno <ueno@unixuser.org> (wk)
* command-ssh.c (reenter_compare_cb): New function; imported from

View file

@ -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)
{