diff --unified --recursive roundcubemail-0.7.2/config/main.inc.php.dist roundcubemail-0.7.2-ja-20120322taka2/config/main.inc.php.dist --- roundcubemail-0.7.2/config/main.inc.php.dist 2012-02-29 23:55:02.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/config/main.inc.php.dist 2012-03-12 12:59:37.000000000 +0900 @@ -741,6 +741,9 @@ // When replying place cursor above original message (top posting) $rcmail_config['top_posting'] = false; +// Default charset for sending message +$rcmail_config['send_charset'] = 'ISO-8859-1'; + // When replying strip original signature from message $rcmail_config['strip_existing_sig'] = true; @@ -757,6 +760,9 @@ // Use MIME encoding (quoted-printable) for 8bit characters in message body $rcmail_config['force_7bit'] = false; +// Use MIME B encoding (base64) for header +$rcmail_config['head_encoding_base64'] = false; + // Defaults of the search field configuration. // The array can contain a per-folder list of header fields which should be considered when searching // The entry with key '*' stands for all folders which do not have a specific list set. diff --unified --recursive roundcubemail-0.7.2/program/include/iniset.php roundcubemail-0.7.2-ja-20120322taka2/program/include/iniset.php --- roundcubemail-0.7.2/program/include/iniset.php 2012-03-12 01:22:50.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/include/iniset.php 2012-03-22 19:09:12.000000000 +0900 @@ -37,7 +37,7 @@ } // application constants -define('RCMAIL_VERSION', '0.7.2'); +define('RCMAIL_VERSION', '0.7.2p-ja'); define('RCMAIL_CHARSET', 'UTF-8'); define('JS_OBJECT_NAME', 'rcmail'); define('RCMAIL_START', microtime(true)); diff --unified --recursive roundcubemail-0.7.2/program/include/rcube_imap.php roundcubemail-0.7.2-ja-20120322taka2/program/include/rcube_imap.php --- roundcubemail-0.7.2/program/include/rcube_imap.php 2012-03-03 22:20:14.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/include/rcube_imap.php 2012-03-22 19:40:16.000000000 +0900 @@ -4100,7 +4100,7 @@ foreach ($a as $val) { $j++; $address = trim($val['address']); - $name = trim($val['name']); + $name = preg_replace(array('/^[\'"]/','/[\'"]$/'),'', trim($val['name'])); if ($name && $address && $name != $address) $string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address); diff --unified --recursive roundcubemail-0.7.2/program/localization/en_US/labels.inc roundcubemail-0.7.2-ja-20120322taka2/program/localization/en_US/labels.inc --- roundcubemail-0.7.2/program/localization/en_US/labels.inc 2012-02-11 22:50:04.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/localization/en_US/labels.inc 2012-03-12 12:59:37.000000000 +0900 @@ -402,6 +402,7 @@ $labels['miscfolding'] = 'RFC 2047/2231 (MS Outlook)'; $labels['2047folding'] = 'Full RFC 2047 (other)'; $labels['force7bit'] = 'Use MIME encoding for 8-bit characters'; +$labels['encodingbase64'] = 'Use MIME B encoding for header'; $labels['advancedoptions'] = 'Advanced options'; $labels['focusonnewmessage'] = 'Focus browser window on new message'; $labels['checkallfolders'] = 'Check all folders for new messages'; diff --unified --recursive roundcubemail-0.7.2/program/localization/ja_JP/labels.inc roundcubemail-0.7.2-ja-20120322taka2/program/localization/ja_JP/labels.inc --- roundcubemail-0.7.2/program/localization/ja_JP/labels.inc 2011-12-07 23:47:32.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/localization/ja_JP/labels.inc 2012-03-12 12:59:37.000000000 +0900 @@ -405,6 +405,7 @@ $labels['miscfolding'] = 'RFC 2047/2231 (MS Outlook)'; $labels['2047folding'] = 'RFC 2047 準拠 (他のメーラー)'; $labels['force7bit'] = 'マルチバイト文字列を MIME エンコードする'; +$labels['encodingbase64'] = 'ヘッダをMIME Base64エンコードする'; $labels['advancedoptions'] = '高度な設定'; $labels['focusonnewmessage'] = '新着メールが届いたらブラウザーをアクティブにする'; $labels['checkallfolders'] = '全フォルダーで新着メールを表示する'; diff --unified --recursive roundcubemail-0.7.2/program/steps/mail/compose.inc roundcubemail-0.7.2-ja-20120322taka2/program/steps/mail/compose.inc --- roundcubemail-0.7.2/program/steps/mail/compose.inc 2012-01-02 04:10:53.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/steps/mail/compose.inc 2012-03-12 12:59:37.000000000 +0900 @@ -1422,6 +1422,16 @@ } +function rcmail_charset_selector($attrib) +{ + global $RCMAIL; + return $RCMAIL->output->charset_selector(array( + 'name' => '_charset', + 'selected' => $RCMAIL->config->get('send_charset') + )); +} + + function rcmail_check_sent_folder($folder, $create=false) { global $IMAP; @@ -1482,6 +1492,7 @@ 'receiptcheckbox' => 'rcmail_receipt_checkbox', 'dsncheckbox' => 'rcmail_dsn_checkbox', 'storetarget' => 'rcmail_store_target_selection', + 'charsetselector' => 'rcmail_charset_selector', )); $OUTPUT->send('compose'); diff --unified --recursive roundcubemail-0.7.2/program/steps/mail/sendmail.inc roundcubemail-0.7.2-ja-20120322taka2/program/steps/mail/sendmail.inc --- roundcubemail-0.7.2/program/steps/mail/sendmail.inc 2012-03-03 22:20:14.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/steps/mail/sendmail.inc 2012-03-22 18:58:32.000000000 +0900 @@ -75,10 +75,18 @@ global $USER, $OUTPUT; if ($sql_arr = $USER->get_identity($id)) { + global $message_charset; $out = $sql_arr; $out['mailto'] = $sql_arr['email']; - $out['string'] = format_email_recipient($sql_arr['email'], - rcube_charset_convert($sql_arr['name'], RCMAIL_CHARSET, $OUTPUT->get_charset())); + $name = rcube_charset_convert($sql_arr['name'], RCMAIL_CHARSET, $message_charset); + if (function_exists('mb_encode_mimeheader')) { + global $RCMAIL; + $head_encoding_mode = $RCMAIL->config->get('head_encoding_base64') ? 'B' : 'Q'; + mb_internal_encoding($message_charset); + $name = mb_encode_mimeheader($name, $message_charset, $head_encoding_mode, "\r\n", 8); + mb_internal_encoding(RCMAIL_CHARSET); + } + $out['string'] = format_email_recipient($sql_arr['email'], $name); return $out; } @@ -180,8 +188,18 @@ if ($name[0] == '"' && $name[count($name)-1] == '"') { $name = substr($name, 1, -1); } - $name = stripcslashes($name); $address = rcube_idn_to_ascii(trim($address, '<>')); + + if (function_exists('mb_encode_mimeheader')) { + global $RCMAIL, $message_charset; + $head_encoding_mode = $RCMAIL->config->get('head_encoding_base64') ? 'B' : 'Q'; + mb_internal_encoding($message_charset); + $name = preg_replace('/^"(.*)"$/', '$1', $name); + $name = mb_encode_mimeheader($name, $message_charset, $head_encoding_mode, "\r\n", 8); + mb_internal_encoding(RCMAIL_CHARSET); + } else { + $name = stripcslashes($name); + } $result[] = format_email_recipient($address, $name); $item = $address; } else if (trim($item)) { @@ -213,7 +231,10 @@ // set default charset $input_charset = $OUTPUT->get_charset(); -$message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $input_charset; +$send_charset = $RCMAIL->config->get('send_charset'); +global $message_charset; +$message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : + $send_charset != '' ? $send_charset : $input_charset; $EMAIL_FORMAT_ERROR = NULL; $RECIPIENT_COUNT = 0; @@ -304,7 +325,7 @@ } $headers['Date'] = rcmail_user_date(); -$headers['From'] = rcube_charset_convert($from_string, RCMAIL_CHARSET, $message_charset); +$headers['From'] = $from_string; $headers['To'] = $mailto; // additional recipients @@ -574,19 +595,22 @@ else $transfer_encoding = '7bit'; +$head_encoding = $RCMAIL->config->get('head_encoding_base64') ? 'base64' : 'quoted-printable'; + // encoding settings for mail composing $MAIL_MIME->setParam('text_encoding', $transfer_encoding); $MAIL_MIME->setParam('html_encoding', 'quoted-printable'); -$MAIL_MIME->setParam('head_encoding', 'quoted-printable'); +$MAIL_MIME->setParam('head_encoding', $head_encoding); $MAIL_MIME->setParam('head_charset', $message_charset); $MAIL_MIME->setParam('html_charset', $message_charset); $MAIL_MIME->setParam('text_charset', $message_charset . ($flowed ? ";\r\n format=flowed" : '')); // encoding subject header with mb_encode provides better results with asian characters if (function_exists('mb_encode_mimeheader')) { + $head_encoding_mode = $RCMAIL->config->get('head_encoding_base64') ? 'B' : 'Q'; mb_internal_encoding($message_charset); $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], - $message_charset, 'Q', "\r\n", 8); + $message_charset, $head_encoding_mode, "\r\n", 8); mb_internal_encoding(RCMAIL_CHARSET); } diff --unified --recursive roundcubemail-0.7.2/program/steps/settings/func.inc roundcubemail-0.7.2-ja-20120322taka2/program/steps/settings/func.inc --- roundcubemail-0.7.2/program/steps/settings/func.inc 2012-02-11 22:50:04.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/steps/settings/func.inc 2012-03-12 12:59:37.000000000 +0900 @@ -532,6 +532,16 @@ ); } + if (!isset($no_override['head_encoding_base64'])) { + $field_id = 'rcmfd_head_encoding_base64'; + $input_7bit = new html_checkbox(array('name' => '_head_encoding_base64', 'id' => $field_id, 'value' => 1)); + + $blocks['main']['options']['head_encoding_base64'] = array( + 'title' => html::label($field_id, Q(rcube_label('encodingbase64'))), + 'content' => $input_7bit->show($config['head_encoding_base64']?1:0), + ); + } + if (!isset($no_override['mdn_default'])) { $field_id = 'rcmfd_mdn_default'; $input_mdn = new html_checkbox(array('name' => '_mdn_default', 'id' => $field_id, 'value' => 1)); @@ -574,6 +584,17 @@ ); } + if (!isset($no_override['send_charset'])) { + $field_id = 'rcmfd_send_charset'; + + $blocks['main']['options']['send_charset'] = array( + 'title' => html::label($field_id, Q(rcube_label('defaultcharset'))), + 'content' => $RCMAIL->output->charset_selector(array( + 'name' => '_send_charset', 'selected' => $config['send_charset'] + )) + ); + } + if (!isset($no_override['spellcheck_before_send']) && $config['enable_spellcheck']) { $field_id = 'rcmfd_spellcheck_before_send'; $input_spellcheck = new html_checkbox(array('name' => '_spellcheck_before_send', 'id' => $field_id, 'value' => 1)); diff --unified --recursive roundcubemail-0.7.2/program/steps/settings/save_prefs.inc roundcubemail-0.7.2-ja-20120322taka2/program/steps/settings/save_prefs.inc --- roundcubemail-0.7.2/program/steps/settings/save_prefs.inc 2012-02-11 22:50:04.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/program/steps/settings/save_prefs.inc 2012-03-12 12:59:37.000000000 +0900 @@ -75,6 +75,7 @@ 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0, 'force_7bit' => isset($_POST['_force_7bit']) ? TRUE : FALSE, + 'head_encoding_base64' => isset($_POST['_head_encoding_base64']) ? TRUE : FALSE, 'mdn_default' => isset($_POST['_mdn_default']) ? TRUE : FALSE, 'dsn_default' => isset($_POST['_dsn_default']) ? TRUE : FALSE, 'reply_same_folder' => isset($_POST['_reply_same_folder']) ? TRUE : FALSE, @@ -86,6 +87,7 @@ 'top_posting' => !empty($_POST['_top_posting']), 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), 'sig_above' => !empty($_POST['_sig_above']) && !empty($_POST['_top_posting']), + 'send_charset' => get_input_value('_send_charset', RCUBE_INPUT_POST), ); break; diff --unified --recursive roundcubemail-0.7.2/skins/default/templates/compose.html roundcubemail-0.7.2-ja-20120322taka2/skins/default/templates/compose.html --- roundcubemail-0.7.2/skins/default/templates/compose.html 2012-01-02 04:10:53.000000000 +0900 +++ roundcubemail-0.7.2-ja-20120322taka2/skins/default/templates/compose.html 2012-03-12 12:59:37.000000000 +0900 @@ -139,6 +139,9 @@ + + +