Index: class/deliver/Deliver.class.php --- class/deliver/Deliver.class.php.orig 2006-05-14 04:56:59.000000000 +0900 +++ class/deliver/Deliver.class.php @@ -593,9 +593,11 @@ class Deliver { while (strlen($line) > $length) { $fold = false; /* handle encoded parts */ - if (preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(\s+|.*)/Ui',$line,$regs)) { + if (preg_match('/(".*")(.*)/Ui', $line, $regs) || + preg_match('/(<.*>)(.*)/Ui', $line, $regs) || + preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(\s+|.*)/Ui',$line,$regs)) { $fold_tmp = $regs[1]; - if (!trim($regs[5])) { + if (isset($regs[5]) && !trim($regs[5])) { $fold_tmp .= $regs[5]; } $iPosEnc = strpos($line,$fold_tmp); @@ -647,6 +649,9 @@ class Deliver { default: break; } + if (substr($line_tmp, $iFoldPos, 2) == '=?') { + $iFoldPos--; + } if (!$iFoldPos) { /* clean folding didn't work */ $iFoldPos = $length; } Index: functions/date.php --- functions/date.php.orig 2006-10-20 17:45:38.000000000 +0900 +++ functions/date.php @@ -351,14 +351,7 @@ function getDateString( $stamp ) { $dateZ = - $dateZ; } - // calculate when it was midnight and when it will be, - // in order to display dates differently if they're 'today' - $midnight = $now - ($now % 86400) - $dateZ; - // this is to correct if after calculations midnight is more than - // one whole day away. - if ($now - $midnight > 86400) { - $midnight += 86400; - } + $midnight = $now - ($now + $dateZ) % 86400; $nextmid = $midnight + 86400; if (($show_full_date == 1) || ($nextmid < $stamp)) { Index: functions/i18n.php --- functions/i18n.php.orig 2006-04-30 13:49:34.000000000 +0900 +++ functions/i18n.php @@ -329,6 +329,7 @@ function set_up_language($sm_language, $ if (function_exists('mb_language')) { mb_language('Japanese'); } + mb_detect_order('ASCII,JIS,EUC-JP,UTF-8,SJIS'); mb_internal_encoding('EUC-JP'); mb_http_output('pass'); } elseif ($squirrelmail_language == 'en_US') { Index: functions/mime.php --- functions/mime.php.orig 2006-12-04 08:06:45.000000000 +0900 +++ functions/mime.php @@ -314,6 +314,14 @@ function formatBody($imap_stream, $messa $body = ''; $urlmailbox = urlencode($mailbox); $body_message = getEntity($message, $ent_num); + + if ($squirrelmail_language == 'ja_JP' && + ($body_message->header->type0 == 'text' && + $body_message->header->type1 == 'plain' && + $body_message->header->getParameter('charset') == 'us-ascii')) { + $body_message->header->setParameter('charset', 'iso-2022-jp'); + } + if (($body_message->header->type0 == 'text') || ($body_message->header->type0 == 'rfc822')) { $body = mime_fetch_body ($imap_stream, $id, $ent_num);