diff -urN functions.orig/mime.php functions/mime.php --- functions.orig/mime.php 2006-09-04 21:37:56.000000000 +0300 +++ functions/mime.php 2006-09-04 21:42:51.000000000 +0300 @@ -16,6 +16,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 */ /* -------------------------------------------------------------------------- */ @@ -344,6 +360,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(' ' => ' ', @@ -358,16 +377,18 @@ $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 { if($squirrelmail_language != 'ja_JP'){ - translateText($body, $wrap_at, - $body_message->header->getParameter('charset')); +// translateText($body, $wrap_at, +// $body_message->header->getParameter('charset')); + translateText($body, $wrap_at, $charset); } else { if($body_message->header->encoding == 'base64' || $body_message->header->encoding == 'quoted-printable' || @@ -375,8 +396,9 @@ translateText($body, $wrap_at, $default_charset); } else { // it may never call here. - translateText($body, $wrap_at, - $body_message->header->getParameter('charset')); +// translateText($body, $wrap_at, +// $body_message->header->getParameter('charset')); + translateText($body, $wrap_at, $charset); } } } @@ -667,6 +689,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 2006-08-03 17:48:09.000000000 +0300 +++ src/compose.php 2006-09-04 21:44:55.000000000 +0300 @@ -687,6 +687,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'; } @@ -790,6 +792,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 2006-09-04 21:37:56.000000000 +0300 +++ src/view_text.php 2006-09-04 21:45:25.000000000 +0300 @@ -58,6 +58,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;