diff -urN functions.orig/mime.php functions/mime.php --- functions.orig/mime.php Sun Nov 6 14:37:08 2005 +++ functions/mime.php Sun Nov 6 16:43:57 2005 @@ -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,14 +365,16 @@ $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); } } else { - translateText($body, $wrap_at, - $body_message->header->getParameter('charset')); +// translateText($body, $wrap_at, +// $body_message->header->getParameter('charset')); + translateText($body, $wrap_at, $charset); } $link = 'passed_id=' . $id . '&ent_id='.$ent_num. @@ -622,6 +643,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 Tue May 31 19:08:15 2005 +++ src/compose.php Sun Nov 6 18:18:36 2005 @@ -677,6 +677,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'; } @@ -780,6 +782,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 Mon Feb 28 01:45:28 2005 +++ src/view_text.php Sun Nov 6 16:48:48 2005 @@ -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;