From d165d11012a3814b129b3dab6419212bad8e5872 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 22 Oct 2014 09:44:39 -0400
Subject: [PATCH] Fix so attachment charset is set in headers of forward/draft message (#1490109)

---
 CHANGELOG                       |    1 +
 program/steps/mail/compose.inc  |    1 +
 program/steps/mail/sendmail.inc |    3 ++-
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index eb79638..978fad2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -49,6 +49,7 @@
 - Don't remove links when html signature is converted to text (#1489621)
 - Fix page title when using search filter (#1490023)
 - Fix mbox files import
+- Fix so attachment charset is set in headers of forward/draft message (#1490109)
 - Fix bug where wrong charset could be used for text attachment preview page (#1490106)
 - Fix setting flags on servers with no PERMANENTFLAGS response (#1490087)
 - Fix regression in SHAA password generation in ldap driver of password plugin (#1490094)
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 2b1ca4d..9b6d0dc 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1377,6 +1377,7 @@
         'data'       => $data,
         'path'       => $path,
         'size'       => $path ? filesize($path) : strlen($data),
+        'charset'    => $part->charset,
     );
 
     $attachment = $rcmail->plugins->exec_hook('attachment_save', $attachment);
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index bac7512..68878d7 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -469,7 +469,8 @@
                 $attachment['data'] ? false : true,
                 $ctype == 'message/rfc822' ? '8bit' : 'base64',
                 'attachment',
-                '', '', '',
+                $attachment['charset'],
+                '', '',
                 $folding ? 'quoted-printable' : NULL,
                 $folding == 2 ? 'quoted-printable' : NULL,
                 '', RCUBE_CHARSET

--
Gitblit v1.9.1