diff --git a/NEWS b/NEWS index a93c7ce80..880e1b92b 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ Noteworthy changes in version 1.9.11 * [gpg-agent] When used without --daemon or --server, gpg-agent now check whether a agent is already running and usable. + * Fixed some i18n problems. + Noteworthy changes in version 1.9.10 (2004-07-22) ------------------------------------------------- diff --git a/g10/ChangeLog b/g10/ChangeLog index 187d8584b..36d5e3314 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,7 @@ 2004-09-30 Werner Koch + * gpgv.c (i18n_init): Always use LC_ALL. + * Makefile.am (LDADD): Adjusted for gettext 0.14. 2004-09-20 Werner Koch diff --git a/g10/gpgv.c b/g10/gpgv.c index 9bd954c6f..015736c33 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -119,12 +119,7 @@ i18n_init(void) set_gettext_file( PACKAGE_GT ); #else #ifdef ENABLE_NLS -#ifdef HAVE_LC_MESSAGES - setlocale( LC_TIME, "" ); - setlocale( LC_MESSAGES, "" ); -#else - setlocale( LC_ALL, "" ); -#endif + setlocale( LC_ALL, "" ); bindtextdomain( PACKAGE_GT, LOCALEDIR ); textdomain( PACKAGE_GT ); #endif diff --git a/kbx/ChangeLog b/kbx/ChangeLog index 546b4c34d..c10ea126a 100644 --- a/kbx/ChangeLog +++ b/kbx/ChangeLog @@ -1,6 +1,8 @@ 2004-09-30 Werner Koch - * Makefile.am: Adjusted fro gettext 0.14. + * kbxutil.c (i18n_init): Always use LC_ALL. + + * Makefile.am: Adjusted for gettext 0.14. 2004-08-24 Werner Koch diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c index cd5da5f77..7fe6178d6 100644 --- a/kbx/kbxutil.c +++ b/kbx/kbxutil.c @@ -129,12 +129,7 @@ i18n_init(void) set_gettext_file( PACKAGE_GT ); #else #ifdef ENABLE_NLS - #ifdef HAVE_LC_MESSAGES - setlocale( LC_TIME, "" ); - setlocale( LC_MESSAGES, "" ); - #else - setlocale( LC_ALL, "" ); - #endif + setlocale( LC_ALL, "" ); bindtextdomain( PACKAGE_GT, LOCALEDIR ); textdomain( PACKAGE_GT ); #endif diff --git a/sm/ChangeLog b/sm/ChangeLog index 1192c8523..36390c344 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,5 +1,17 @@ 2004-09-30 Werner Koch + * gpgsm.c (i18n_init): Always use LC_ALL. + + * certdump.c (gpgsm_format_name): Factored code out to .. + (gpgsm_format_name2): .. new. + (gpgsm_print_name): Factored code out to .. + (gpgsm_print_name2): .. new. + (print_dn_part): New arg TRANSLATE. Changed all callers. + (print_dn_parts): Ditto. + (gpgsm_format_keydesc): Do not translate the SUBJECT; we require + it to stay UTF-8 but we still want to filter out bad control + characters. + * Makefile.am: Adjusted for gettext 0.14. * keylist.c (list_cert_colon): Make sure that the expired flag has diff --git a/sm/certdump.c b/sm/certdump.c index 33052b186..cdf4edcc1 100644 --- a/sm/certdump.c +++ b/sm/certdump.c @@ -427,7 +427,7 @@ parse_dn (const unsigned char *string) static void -print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key) +print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key, int translate) { struct dn_array_s *first_dn = dn; @@ -446,7 +446,10 @@ print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key) if (!dn->done && dn->value && *dn->value) { fprintf (fp, "/%s=", dn->key); - print_sanitized_utf8_string (fp, dn->value, '/'); + if (translate) + print_sanitized_utf8_string (fp, dn->value, '/'); + else + print_sanitized_string (fp, dn->value, '/'); } dn->done = 1; if (dn > first_dn && dn[-1].multivalued) @@ -461,7 +464,7 @@ print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key) /* Print all parts of a DN in a "standard" sequence. We first print all the known parts, followed by the uncommon ones */ static void -print_dn_parts (FILE *fp, struct dn_array_s *dn) +print_dn_parts (FILE *fp, struct dn_array_s *dn, int translate) { const char *stdpart[] = { "CN", "OU", "O", "STREET", "L", "ST", "C", "EMail", NULL @@ -469,17 +472,17 @@ print_dn_parts (FILE *fp, struct dn_array_s *dn) int i; for (i=0; stdpart[i]; i++) - print_dn_part (fp, dn, stdpart[i]); + print_dn_part (fp, dn, stdpart[i], translate); /* Now print the rest without any specific ordering */ for (; dn->key; dn++) - print_dn_part (fp, dn, dn->key); + print_dn_part (fp, dn, dn->key, translate); } void -gpgsm_print_name (FILE *fp, const char *name) +gpgsm_print_name2 (FILE *fp, const char *name, int translate) { const unsigned char *s; int i; @@ -493,7 +496,12 @@ gpgsm_print_name (FILE *fp, const char *name) { const unsigned char *s2 = strchr (s+1, '>'); if (s2) - print_sanitized_utf8_buffer (fp, s + 1, s2 - s - 1, 0); + { + if (translate) + print_sanitized_utf8_buffer (fp, s + 1, s2 - s - 1, 0); + else + print_sanitized_buffer (fp, s + 1, s2 - s - 1, 0); + } } else if (*s == '(') fputs (_("[Error - unknown encoding]"), fp); @@ -508,7 +516,7 @@ gpgsm_print_name (FILE *fp, const char *name) fputs (_("[Error - invalid DN]"), fp); else { - print_dn_parts (fp, dn); + print_dn_parts (fp, dn, translate); for (i=0; dn[i].key; i++) { xfree (dn[i].key); @@ -520,6 +528,12 @@ gpgsm_print_name (FILE *fp, const char *name) } +void +gpgsm_print_name (FILE *fp, const char *name) +{ + gpgsm_print_name2 (fp, name, 1); +} + /* A cookie structure used for the memory stream. */ struct format_name_cookie @@ -558,9 +572,11 @@ format_name_writer (void *cookie, const char *buffer, size_t size) /* Format NAME which is expected to be in rfc2253 format into a better human readable format. Caller must free the returned string. NULL - is returned in case of an error. */ + is returned in case of an error. With TRANSLATE set to true the + name will be translated to the native encodig. Note that NAME is + internally always UTF-8 encoded. */ char * -gpgsm_format_name (const char *name) +gpgsm_format_name2 (const char *name, int translate) { #if defined (HAVE_FOPENCOOKIE) || defined (HAVE_FUNOPEN) FILE *fp; @@ -587,7 +603,7 @@ gpgsm_format_name (const char *name) errno = save_errno; return NULL; } - gpgsm_print_name (fp, name); + gpgsm_print_name2 (fp, name, translate); fclose (fp); if (cookie.error || !cookie.buffer) { @@ -601,6 +617,12 @@ gpgsm_format_name (const char *name) #endif /* No fun. */ } +char * +gpgsm_format_name (const char *name) +{ + return gpgsm_format_name2 (name, 1); +} + /* Create a key description for the CERT, this may be passed to the pinentry. The caller must free the returned string. NULL may be @@ -618,7 +640,7 @@ gpgsm_format_keydesc (ksba_cert_t cert) char *orig_codeset = NULL; name = ksba_cert_get_subject (cert, 0); - subject = name? gpgsm_format_name (name) : NULL; + subject = name? gpgsm_format_name2 (name, 0) : NULL; ksba_free (name); name = NULL; sexp = ksba_cert_get_serial (cert); diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 5e3e0f2d9..6e2bbe742 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -560,12 +560,7 @@ i18n_init(void) set_gettext_file (PACKAGE_GT); #else # ifdef ENABLE_NLS -# ifdef HAVE_LC_MESSAGES - setlocale (LC_TIME, ""); - setlocale (LC_MESSAGES, ""); -# else setlocale (LC_ALL, "" ); -# endif bindtextdomain (PACKAGE_GT, LOCALEDIR); textdomain (PACKAGE_GT); # endif diff --git a/sm/gpgsm.h b/sm/gpgsm.h index 72486aadb..18f50e9fe 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -202,6 +202,7 @@ void gpgsm_destroy_writer (Base64Context ctx); /*-- certdump.c --*/ void gpgsm_print_serial (FILE *fp, ksba_const_sexp_t p); void gpgsm_print_time (FILE *fp, ksba_isotime_t t); +void gpgsm_print_name2 (FILE *fp, const char *string, int translate); void gpgsm_print_name (FILE *fp, const char *string); void gpgsm_dump_cert (const char *text, ksba_cert_t cert); @@ -210,6 +211,7 @@ void gpgsm_dump_time (ksba_isotime_t t); void gpgsm_dump_string (const char *string); char *gpgsm_format_serial (ksba_const_sexp_t p); +char *gpgsm_format_name2 (const char *name, int translate); char *gpgsm_format_name (const char *name); char *gpgsm_format_keydesc (ksba_cert_t cert); diff --git a/tools/ChangeLog b/tools/ChangeLog index fa6572ae7..1eefac53a 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,5 +1,7 @@ 2004-09-30 Werner Koch + * gpgconf.c (i18n_init): Always use LC_ALL. + * Makefile.am: Adjusted for gettext 0.14. 2004-09-29 Werner Koch diff --git a/tools/gpgconf.c b/tools/gpgconf.c index 7aca335fa..e3e1b9f1a 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -106,12 +106,7 @@ i18n_init(void) set_gettext_file (PACKAGE_GT); #else # ifdef ENABLE_NLS -# ifdef HAVE_LC_MESSAGES - setlocale (LC_TIME, ""); - setlocale (LC_MESSAGES, ""); -# else setlocale (LC_ALL, "" ); -# endif bindtextdomain (PACKAGE_GT, LOCALEDIR); textdomain (PACKAGE_GT); # endif