summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-10-23 11:30:05 -0300
committerTomás Touceda <chiiph@leap.se>2013-10-23 11:30:05 -0300
commit3c6278bfb1ec36af7255b982560f5c5dcce42992 (patch)
tree5b34baf0aaaf8324a196bbe2867abb9ca264498f /src
parentdc0bcbf2dc96f45ac1e85936549d46234706fe26 (diff)
parentb7011658fc6e36f439cd156ce6e519868a410d55 (diff)
Merge remote-tracking branch 'ivan/bug/4000_support-non-ascii' into develop
Diffstat (limited to 'src')
-rw-r--r--src/leap/keymanager/openpgp.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/leap/keymanager/openpgp.py b/src/leap/keymanager/openpgp.py
index 6412331..8ec8639 100644
--- a/src/leap/keymanager/openpgp.py
+++ b/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):
"""