diff --unified --recursive roundcubemail-0.8.0/config/main.inc.php.dist roundcubemail-0.8.0p-ja/config/main.inc.php.dist --- roundcubemail-0.8.0/config/main.inc.php.dist 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/config/main.inc.php.dist 2012-08-08 09:58:51.000000000 +0900 @@ -774,6 +774,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; @@ -790,6 +793,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.8.0/program/include/iniset.php roundcubemail-0.8.0p-ja/program/include/iniset.php --- roundcubemail-0.8.0/program/include/iniset.php 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/include/iniset.php 2012-08-08 10:00:15.000000000 +0900 @@ -42,7 +42,7 @@ } // application constants -define('RCMAIL_VERSION', '0.8.0'); +define('RCMAIL_VERSION', '0.8.0p-ja'); define('RCMAIL_CHARSET', 'UTF-8'); define('JS_OBJECT_NAME', 'rcmail'); define('RCMAIL_START', microtime(true)); diff --unified --recursive roundcubemail-0.8.0/program/include/rcube_mime.php roundcubemail-0.8.0p-ja/program/include/rcube_mime.php --- roundcubemail-0.8.0/program/include/rcube_mime.php 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/include/rcube_mime.php 2012-08-08 11:21:34.000000000 +0900 @@ -151,7 +151,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.8.0/program/localization/en_US/labels.inc roundcubemail-0.8.0p-ja/program/localization/en_US/labels.inc --- roundcubemail-0.8.0/program/localization/en_US/labels.inc 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/localization/en_US/labels.inc 2012-08-08 09:58:51.000000000 +0900 @@ -420,6 +420,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.8.0/program/localization/ja_JP/labels.inc roundcubemail-0.8.0p-ja/program/localization/ja_JP/labels.inc --- roundcubemail-0.8.0/program/localization/ja_JP/labels.inc 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/localization/ja_JP/labels.inc 2012-08-08 10:03:19.000000000 +0900 @@ -360,6 +360,7 @@ $labels['miscfolding'] = 'RFC 2047/2231(MS Outlook)'; $labels['2047folding'] = 'RFC 2047に完全準拠(その他)'; $labels['force7bit'] = '8ビット文字列にMIMEエンコードを使用'; +$labels['encodingbase64'] = 'ヘッダをMIME Base64エンコードする'; $labels['advancedoptions'] = '高度な設定'; $labels['focusonnewmessage'] = '新しいメッセージが届いたらブラウザーをアクティブ'; $labels['checkallfolders'] = 'すべてのフォルダーで新着メールを表示'; diff --unified --recursive roundcubemail-0.8.0/program/steps/mail/compose.inc roundcubemail-0.8.0p-ja/program/steps/mail/compose.inc --- roundcubemail-0.8.0/program/steps/mail/compose.inc 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/steps/mail/compose.inc 2012-08-08 10:04:50.000000000 +0900 @@ -1483,6 +1483,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 $RCMAIL; @@ -1595,6 +1605,7 @@ 'receiptcheckbox' => 'rcmail_receipt_checkbox', 'dsncheckbox' => 'rcmail_dsn_checkbox', 'storetarget' => 'rcmail_store_target_selection', + 'charsetselector' => 'rcmail_charset_selector', 'addressbooks' => 'rcmail_addressbook_list', 'addresslist' => 'rcmail_contacts_list', )); diff --unified --recursive roundcubemail-0.8.0/program/steps/mail/sendmail.inc roundcubemail-0.8.0p-ja/program/steps/mail/sendmail.inc --- roundcubemail-0.8.0/program/steps/mail/sendmail.inc 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/steps/mail/sendmail.inc 2012-08-08 11:27:13.000000000 +0900 @@ -78,10 +78,18 @@ global $RCMAIL, $OUTPUT; if ($sql_arr = $RCMAIL->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; } @@ -153,6 +161,12 @@ { global $RCMAIL, $EMAIL_FORMAT_ERROR, $RECIPIENT_COUNT; + // convert UTF-8 to preserve \x2c(,) and \x3b(;) used in ISO-2022-JP; + if (function_exists('mb_encode_mimeheader') + && function_exists('mb_convert_encoding')) { + global $message_charset; + $mailto = mb_convert_encoding($mailto, 'UTF-8', $message_charset); + } // simplified email regexp, supporting quoted local part $email_regexp = '(\S+|("[^"]+"))@\S+'; @@ -183,8 +197,21 @@ if ($name[0] == '"' && $name[count($name)-1] == '"') { $name = substr($name, 1, -1); } - $name = stripcslashes($name); $address = rcube_idn_to_ascii(trim($address, '<>')); + + // encode "name" field. + if (function_exists('mb_encode_mimeheader') + && function_exists('mb_convert_encoding')) { + global $message_charset; + $head_encoding_mode = $RCMAIL->config->get('head_encoding_base64') ? 'B' : 'Q'; + $name = mb_convert_encoding($name, $message_charset, 'UTF-8'); + 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)) { @@ -216,7 +243,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; @@ -307,7 +337,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 @@ -584,19 +614,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.8.0/program/steps/settings/func.inc roundcubemail-0.8.0p-ja/program/steps/settings/func.inc --- roundcubemail-0.8.0/program/steps/settings/func.inc 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/steps/settings/func.inc 2012-08-08 09:58:51.000000000 +0900 @@ -517,6 +517,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)); @@ -560,6 +570,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.8.0/program/steps/settings/save_prefs.inc roundcubemail-0.8.0p-ja/program/steps/settings/save_prefs.inc --- roundcubemail-0.8.0/program/steps/settings/save_prefs.inc 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/program/steps/settings/save_prefs.inc 2012-08-08 10:11:19.000000000 +0900 @@ -77,6 +77,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, @@ -88,6 +89,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), 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST), 'forward_attachment' => !empty($_POST['_forward_attachment']), ); diff --unified --recursive roundcubemail-0.8.0/skins/classic/templates/compose.html roundcubemail-0.8.0p-ja/skins/classic/templates/compose.html --- roundcubemail-0.8.0/skins/classic/templates/compose.html 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/skins/classic/templates/compose.html 2012-08-08 10:13:11.000000000 +0900 @@ -145,6 +145,9 @@ + + + diff --unified --recursive roundcubemail-0.8.0/skins/larry/templates/compose.html roundcubemail-0.8.0p-ja/skins/larry/templates/compose.html --- roundcubemail-0.8.0/skins/larry/templates/compose.html 2012-08-07 01:18:13.000000000 +0900 +++ roundcubemail-0.8.0p-ja/skins/larry/templates/compose.html 2012-08-08 10:14:48.000000000 +0900 @@ -143,6 +143,10 @@ + + + +