Right now decodeHeader will encode the non-ascii text into the HTML
authorgraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 31 Dec 2001 21:53:52 +0000 (21:53 +0000)
committergraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 31 Dec 2001 21:53:52 +0000 (21:53 +0000)
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
src/compose.php

index 24e11590200449eec14dbe2840d0437525c915a3..fd706e71a25b44ab57cb38727e07354426e334fb 100644 (file)
@@ -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)\\?([^?]+)\\?=',
index 1d02ab7da142c2df7b6a5a4fcf605ee11822bbfc..c2433a26c614c17f460f4e1ed699d0096f8cb9c7 100644 (file)
@@ -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". '<SCRIPT LANGUAGE=JavaScript><!--' . "\n" .