diff -urN functions.orig/mime.php functions/mime.php --- functions.orig/mime.php Thu Feb 23 16:13:47 2006 +++ functions/mime.php Sun May 14 00:32:35 2006 @@ -17,6 +17,22 @@ require_once(SM_PATH . 'functions/imap.php'); require_once(SM_PATH . 'functions/attachment_common.php'); +$other_charsets = Array( + 'KOI8-RU' => 'KOI8-R', + 'KOI8R' => 'KOI8-R', + 'KOI8' => 'KOI8-R', + 'CSKOI8R' => 'KOI8-R', + 'KOI8-UA' => 'KOI8-U', +// 'CP1251' => 'WINDOWS-1251', + 'MACCYRILLIC' => 'X-MAC-CYRILLIC', + 'MAC-CYRILLIC' => 'X-MAC-CYRILLIC', +// 'CP866' => 'IBM866', + 'CP-866' => 'IBM866', + 'X-CP866' => 'IBM866', + 'CSIBM866' => 'IBM866', + '866' => 'IBM866' +); + /* -------------------------------------------------------------------------- */ /* MIME DECODING */ /* -------------------------------------------------------------------------- */ @@ -332,6 +348,9 @@ * them here. */ + global $other_charsets; + $charset = $other_charsets[strtoupper($body_message->header->getParameter('charset'))]; + if (!$charset) $charset = $body_message->header->getParameter('charset'); if ($body_message->header->type1 == 'html') { if ($show_html_default <> 1) { $entity_conv = array(' ' => ' ', @@ -346,15 +365,17 @@ $body = strtr($body, $entity_conv); $body = strip_tags($body); $body = trim($body); - translateText($body, $wrap_at, - $body_message->header->getParameter('charset')); +// translateText($body, $wrap_at, +// $body_message->header->getParameter('charset')); + translateText($body, $wrap_at, $charset); } else { $body = magicHTML($body, $id, $message, $mailbox); $body = charset_decode($body_message->header->getParameter('charset'),$body,false,true); } } else { - translateText($body, $wrap_at, - $body_message->header->getParameter('charset')); +// translateText($body, $wrap_at, +// $body_message->header->getParameter('charset')); + translateText($body, $wrap_at, $charset); } // if this is the clean display (i.e. printer friendly), stop here. @@ -635,6 +656,8 @@ $encoding = ucfirst($res[3]); /* decide about valid decoding */ + global $other_charsets; + if ($other_charsets[strtoupper($res[2])]) $res[2] = $other_charsets[strtoupper($res[2])]; if ($decide && is_conversion_safe($res[2])) { $can_be_encoded=true; } else { diff -urN src.orig/compose.php src/compose.php --- src.orig/compose.php Sat Feb 4 00:27:55 2006 +++ src/compose.php Sun May 14 00:37:36 2006 @@ -682,6 +682,8 @@ // charset encoding in compose form stuff if (isset($body_part_entity->header->parameters['charset'])) { $actual = $body_part_entity->header->parameters['charset']; + global $other_charsets; + if ($other_charsets[strtoupper($actual)]) $actual = $other_charsets[strtoupper($actual)]; } else { $actual = 'us-ascii'; } @@ -785,6 +787,12 @@ $body = "\n" . $body; break; case ('forward_as_attachment'): + $subject = decodeHeader($orig_header->subject,false,false,true); + if ((substr(strtolower($subject), 0, 4) != 'fwd:') && + (substr(strtolower($subject), 0, 5) != '[fwd:') && + (substr(strtolower($subject), 0, 6) != '[ fwd:')) { + $subject = '[Fwd: ' . $subject . ']'; + } $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imapConnection); $body = ''; break; diff -urN src.orig/view_text.php src/view_text.php --- src.orig/view_text.php Sat Feb 4 00:27:55 2006 +++ src/view_text.php Sun May 14 00:38:27 2006 @@ -59,6 +59,8 @@ $type0 = $header->type0; $type1 = $header->type1; $charset = $header->getParameter('charset'); +global $other_charsets; +if ($other_charsets[strtoupper($charset)]) $charset = $other_charsets[strtoupper($charset)]; $encoding = strtolower($header->encoding); $msg_url = 'read_body.php?' . $QUERY_STRING;