From 9cd2ee1e1b96ad521967096424b0b9ff16ed82da Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 23 Oct 2013 10:39:28 -0300 Subject: Return unicode in order to solve encoding issues. --- keymanager/src/leap/keymanager/openpgp.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'keymanager/src/leap') diff --git a/keymanager/src/leap/keymanager/openpgp.py b/keymanager/src/leap/keymanager/openpgp.py index 6412331..8ec8639 100644 --- a/keymanager/src/leap/keymanager/openpgp.py +++ b/keymanager/src/leap/keymanager/openpgp.py @@ -26,6 +26,7 @@ import os import re import shutil import tempfile +import locale from gnupg import GPG from gnupg.gnupg import GPGUtilities @@ -482,7 +483,7 @@ class OpenPGPScheme(EncryptionScheme): :type verify: OpenPGPKey :return: The decrypted data. - :rtype: str + :rtype: unicode @raise InvalidSignature: Raised if unable to verify the signature with C{verify} key. @@ -504,7 +505,12 @@ class OpenPGPScheme(EncryptionScheme): raise errors.InvalidSignature( 'Failed to verify signature with key %s: %s' % (verify.key_id, stderr)) - return result.data + + # XXX: this is the encoding used by gpg module + # https://github.com/isislovecruft/python-gnupg/\ + # blob/master/gnupg/_meta.py#L121 + encoding = locale.getpreferredencoding() + return result.data.decode(encoding, 'replace') def is_encrypted(self, data): """ -- cgit v1.2.3