From 4d7d97b3aac40b54ec9b36259710e6ba182a06ae Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 7 Mar 2012 23:50:32 +0800 Subject: Bug 729558: fix securemail corruption of unicode emails --- extensions/SecureMail/Extension.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index 97722d9ac..4e1bbf237 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -32,6 +32,7 @@ use Crypt::OpenPGP::Armour; use Crypt::OpenPGP::KeyRing; use Crypt::OpenPGP; use Crypt::SMIME; +use Encode; our $VERSION = '0.4'; @@ -256,11 +257,16 @@ sub _make_secure { ################## # PGP Encryption # ################## - my $body = $email->body; + + # We need to work with the body as a decoded string as we may + # modify it + my $body = $email->body_str; if ($is_bugmail) { # Subject gets placed in the body so it can still be read $body = "Subject: $subject\n\n" . $body; } + # Crypt::OpenPGP requires an encoded string + $body = encode('UTF8', $body); my $pubring = new Crypt::OpenPGP::KeyRing(Data => $key); my $pgp = new Crypt::OpenPGP(PubRing => $pubring); -- cgit v1.2.3-24-g4f1b