From 3b4872168a541cef38d8a4ba2357c9afc3cf7041 Mon Sep 17 00:00:00 2001 From: graf25 Date: Mon, 31 Dec 2001 21:53:52 +0000 Subject: [PATCH] Right now decodeHeader will encode the non-ascii text into the HTML entities. However, some places don't need that, for example the compose form, otherwise the subject and other fields turn into the #&NNNN;#&NNNN; stuff. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2067 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 9 ++++++--- src/compose.php | 14 +++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index 24e11590..fd706e71 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -755,7 +755,7 @@ class msg_header { // This functions decode strings that is encoded according to // RFC1522 (MIME Part Two: Message Header Extensions for Non-ASCII Text). - function decodeHeader ($string) { + function decodeHeader ($string, $utfencode=true) { if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=', $string, $res)) { if (ucfirst($res[2]) == "B") { @@ -769,8 +769,11 @@ class msg_header { } $replace = quoted_printable_decode($replace); } - - $replace = charset_decode ($res[1], $replace); + /* Only encode into entities by default. Some places + don't need the encoding, like the compose form. */ + if ($utfencode){ + $replace = charset_decode ($res[1], $replace); + } // Remove the name of the character set. $string = eregi_replace ('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=', diff --git a/src/compose.php b/src/compose.php index 1d02ab7d..c2433a26 100644 --- a/src/compose.php +++ b/src/compose.php @@ -237,9 +237,9 @@ function newMail () { $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size, $draft_id, $use_signature; - $send_to = decodeHeader($send_to); - $send_to_cc = decodeHeader($send_to_cc); - $send_to_bcc = decodeHeader($send_to_bcc); + $send_to = decodeHeader($send_to, false); + $send_to_cc = decodeHeader($send_to_cc, false); + $send_to_bcc = decodeHeader($send_to_bcc, false); if ($forward_id) { $id = $forward_id; @@ -316,7 +316,7 @@ function newMail () { $body = $bodyTop . $body; } elseif ($reply_id) { - $orig_from = decodeHeader($orig_header->from); + $orig_from = decodeHeader($orig_header->from, false); $body = getReplyCitation($orig_from) . $body; } @@ -421,9 +421,9 @@ function showInputForm () { $username, $data_dir, $identity, $draft_id, $delete_draft, $mailprio; - $subject = decodeHeader($subject); - $reply_subj = decodeHeader($reply_subj); - $forward_subj = decodeHeader($forward_subj); + $subject = decodeHeader($subject, false); + $reply_subj = decodeHeader($reply_subj, false); + $forward_subj = decodeHeader($forward_subj, false); if ($use_javascript_addr_book) { echo "\n". '