From e0134958fd4abf68ac9484f9b69772549963e6f9 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 20 Mar 2010 16:29:17 +0000 Subject: [PATCH] Cope with UTF-8 in GPG key names --- zeroinstall/injector/gpg.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zeroinstall/injector/gpg.py b/zeroinstall/injector/gpg.py index 8809641..cadcbc3 100644 --- a/zeroinstall/injector/gpg.py +++ b/zeroinstall/injector/gpg.py @@ -135,6 +135,7 @@ def load_keys(fingerprints): @return: a list of loaded keys, indexed by fingerprint @rtype: {str: L{Key}} @since: 0.27""" + import codecs keys = {} @@ -160,7 +161,11 @@ def load_keys(fingerprints): # This is probably a subordinate key, where the fingerprint # comes after the uid, not before. Note: we assume the subkey is # cross-certified, as recent always ones are. - keys[current_fpr].name = current_uid + try: + keys[current_fpr].name = codecs.decode(current_uid, 'utf-8') + except: + warn("Not UTF-8: %s", current_uid) + keys[current_fpr].name = current_uid if line.startswith('uid:'): assert current_fpr is not None # Only take primary UID -- 2.11.4.GIT