From 040b1ed40ada7c9ce095dec696406aea730e3766 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Tue, 24 Jul 2018 14:50:54 +0200 Subject: [PATCH] js: Fix wrong encoding in received error messages -- * The libgpg error strings arrive in the browser in a different encoding than used by browsers. Escaping and then decoding it should cover most languages in the supported browsers. --- lang/js/src/Connection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index ef54dd64..d89fa724 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -240,7 +240,8 @@ class Answer{ switch (key) { case 'type': if (_decodedResponse.type === 'error'){ - return (gpgme_error('GNUPG_ERROR', _decodedResponse.msg)); + return (gpgme_error('GNUPG_ERROR', + decodeURIComponent(escape(_decodedResponse.msg)))); } else if (poa.type.indexOf(_decodedResponse.type) < 0){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); }