From 5660489759ee4c09fab53e0770f98214c0d2abf9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 27 Sep 2017 08:57:22 +0200 Subject: [PATCH] Fix decryption of messages encoded with non-ascii charset (#5962) --- CHANGELOG | 1 + plugins/enigma/lib/enigma_engine.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 704bd8bbee6..46ac6e9a5f6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -47,6 +47,7 @@ CHANGELOG Roundcube Webmail - Fix invalid template loading on a message error in preview frame (#5941) - Fix bug where HTML messages could have been rendered empty on some systems (#5957) - Fix wording of "Mark previewed messages as read" to "Mark messages as read" (#5952) +- Enigma: Fix decryption of messages encoded with non-ascii charset (#5962) RELEASE 1.3.1 ------------- diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php index 68908450f3e..e0bd8bc2745 100644 --- a/plugins/enigma/lib/enigma_engine.php +++ b/plugins/enigma/lib/enigma_engine.php @@ -1196,6 +1196,11 @@ private function get_part_body($msg, $part) } else { $body = $msg->get_part_body($part->mime_id, false); + + // Convert charset to get rid of possible non-ascii characters (#5962) + if ($part->charset && stripos($part->charset, 'ASCII') === false) { + $body = rcube_charset::convert($body, $part->charset, 'US-ASCII'); + } } return $body;