aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 42e2927b6..16b34f00f 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -163,6 +163,21 @@ cache_public_key( PKT_public_key *pk )
}
+/* Return a const utf-8 string with the text "[User ID not found]".
+ This fucntion is required so that we don't need to switch gettext's
+ encoding temporary. */
+static const char *
+user_id_not_found_utf8 (void)
+{
+ static char *text;
+
+ if (!text)
+ text = native_to_utf8 (_("[User ID not found]"));
+ return text;
+}
+
+
+
/*
* Return the user ID from the given keyblock.
* We use the primary uid flag which has been set by the merge_selfsigs
@@ -183,9 +198,7 @@ get_primary_uid ( KBNODE keyblock, size_t *uidlen )
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 = user_id_not_found_utf8 ();
*uidlen = strlen (s);
return s;
}
@@ -2886,7 +2899,7 @@ get_user_id( u32 *keyid, size_t *rn )
}
}
} while( ++pass < 2 && !get_pubkey( NULL, keyid ) );
- p = xstrdup( _("[User ID not found]") );
+ p = xstrdup( user_id_not_found_utf8 () );
*rn = strlen(p);
return p;
}