From 27be4e7644637255d7adbf5386ec883d9c2c64cd Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 15 Oct 2012 08:24:30 -0400
Subject: [PATCH] Fix header charset decoding when opening a draft message

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

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 04efe7d..fd34ee0 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -423,6 +423,8 @@
       $fvalue = $MESSAGE->get_header('reply-to');
     else if ($header=='followupto' && !empty($MESSAGE->headers->others['mail-followup-to']))
       $fvalue = $MESSAGE->get_header('mail-followup-to');
+
+    $decode_header = false;  // $MESSAGE->get_header() returns already decoded header values
   }
 
   // split recipients and put them back together in a unique way
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index ee6a3d3..a0c0496 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -256,8 +256,7 @@
 $message_id = rcmail_gen_message_id();
 
 // set default charset
-$input_charset = $OUTPUT->get_charset();
-$message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $input_charset;
+$message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $OUTPUT->get_charset();
 
 $EMAIL_FORMAT_ERROR = NULL;
 $RECIPIENT_COUNT = 0;

--
Gitblit v1.9.1