View Issue Details

IDProjectCategoryView StatusLast Update
0003812mantisbtlocalizationpublic2009-06-26 12:01
Reportertakeshi Assigned Tosiebrand  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionwon't fix 
Summary0003812: [jp] Mantis send broken email when lang=Japanese_euc
Description

see patch

TagsNo tags attached.
Attached Files
mantis-jp-email.patch (4,034 bytes)   
diff -ru /tmp/mantis-0.18.2/core/email_api.php mantis/core/email_api.php
--- /tmp/mantis-0.18.2/core/email_api.php	2004-02-27 00:36:28.000000000 +0900
+++ mantis/core/email_api.php	2004-05-07 10:15:34.000000000 +0900
@@ -580,11 +580,17 @@
 	# --------------------
 	# this function sends the actual email
 	function email_send( $p_recipient, $p_subject, $p_message, $p_header='', $p_category='' ) {
+#JP
+	   global $g_default_language;
 		global $g_from_email,
 				$g_return_path_email, $g_use_x_priority,
 				$g_use_phpMailer, $g_phpMailer_method, $g_smtp_host,
 				$g_smtp_username, $g_smtp_password, $g_mail_priority;
 
+#JP
+		$jpmail = eregi('Japanese', $g_default_language);
+		$jpcode = eregi('EUC', $g_default_language)  ?  'EUC-JP'  :  'SJIS';
+
 		$t_recipient = trim( $p_recipient );
 		$t_subject   = string_email( trim( $p_subject ) );
 		$t_message   = string_email_links( trim( $p_message ) );
@@ -639,6 +645,11 @@
 			if ( ! is_blank( $g_smtp_username ) ) {     # Use SMTP Authentication
 				$mail->SMTPAuth = true;
 				$mail->Username = $g_smtp_username;
+#JP
+				if ($jpmail) {
+				   $mail->Username = mb_convert_encoding ($g_smtp_username, "JIS", $jpcode);
+				}
+
 				$mail->Password = $g_smtp_password;
 			}
 
@@ -687,6 +698,11 @@
 
 			$mail->Subject = $t_subject;
 			$mail->Body    = make_lf_crlf( "\n".$t_message );
+#JP
+			if ($jpmail) {
+			   $mail->Subject = "=?iso-2022-jp?B?" . base64_encode( mb_convert_encoding ($mail->Subject, "JIS", $jpcode) ) . "?=";
+			   $mail->Body    = mb_convert_encoding ($mail->Body, "JIS", $jpcode);
+			}
 			
 			if ( EMAIL_CATEGORY_PROJECT_CATEGORY == config_get( 'email_set_category' ) ) {
 				$mail->AddCustomHeader( "Keywords: $p_category" );
@@ -709,7 +725,13 @@
 			if ( ON == $g_use_x_priority ) {
 				$t_headers .= "X-Priority: $g_mail_priority\n";    # Urgent = 1, Not Urgent = 5, Disable = 0
 			}
-			$t_headers .= 'Content-Type: text/plain; charset=' . lang_get( 'charset' ) . "\n";
+#JP
+			if ($jpmail) {
+			   $t_headers .= 'Content-Type: text/plain; charset=ISO-2022-JP' . "\n";
+			}
+			else {
+			   $t_headers .= 'Content-Type: text/plain; charset=' . lang_get( 'charset' ) . "\n";
+			}
 
 			if ( EMAIL_CATEGORY_PROJECT_CATEGORY == config_get( 'email_set_category' ) ) {
 				$t_headers .= "Keywords: $p_category\n";
@@ -726,6 +748,13 @@
 			$t_subject = make_lf_crlf( $t_subject );
 			$t_message = make_lf_crlf( $t_message );
 			$t_headers = make_lf_crlf( $t_headers );
+#JP
+			if ($jpmail) {
+			   $t_recipient = mb_convert_encoding ($t_recipient, "JIS", $jpcode);
+			   $t_subject = "=?iso-2022-jp?B?" . base64_encode( mb_convert_encoding ($t_subject, "JIS", $jpcode) ) . "?=";
+			   $t_message = mb_convert_encoding ($t_message, "JIS", $jpcode);
+			   $t_headers = mb_convert_encoding ($t_headers, "JIS", $jpcode);
+			}
 
 			# set the SMTP host... only used on window though
 			ini_set( 'SMTP', config_get( 'smtp_host', 'localhost' ) );
diff -ru /tmp/mantis-0.18.2/core/utility_api.php mantis/core/utility_api.php
--- /tmp/mantis-0.18.2/core/utility_api.php	2004-01-11 17:16:10.000000000 +0900
+++ mantis/core/utility_api.php	2004-05-07 10:24:26.000000000 +0900
@@ -25,10 +25,15 @@
 	# converts a 1 value to X
 	# converts a 0 value to a space
 	function trans_bool( $p_num ) {
+#JP
+	   global $g_default_language;
+		$jpmail = eregi('Japanese', $g_default_language);
+
 		if ( 0 == $p_num ) {
 			return ' ';
 		} else {
-			return 'X';
+		   return ($jpmail)  ?  'O'  : 'X';
+#			return 'X';
 		}
 	}
 
diff -ru /tmp/mantis-0.18.2/lang/strings_japanese_euc.txt mantis/lang/strings_japanese_euc.txt
--- /tmp/mantis-0.18.2/lang/strings_japanese_euc.txt	2004-02-26 23:24:10.000000000 +0900
+++ mantis/lang/strings_japanese_euc.txt	2004-05-03 14:50:27.000000000 +0900
@@ -16,7 +16,7 @@
 ?>
 <?php
 # Charset
-$s_charset = 'x-euc-jp';
+$s_charset = 'euc-jp';
 
 # Group commands menuitems
 $s_actiongroup_menu_move = 'Move';
mantis-jp-email.patch (4,034 bytes)   

Relationships

related to 0004084 closedsiebrand [all lang] Use UTF-8 codepage 
child of 0004181 closed Features in Mantis 1.1 release 

Activities

seiji

seiji

2006-09-25 10:30

reporter   ~0013509

Last edited: 2006-09-28 10:02

Certainly, when email is sent, We japanese should use "ISO-2022-JP".(7bit encoding)
However, it is necessary to use the function of multi byte function to do it.
But it is the policy not to use these functions.(iconv, mb_* and so on)

I think that we cannot do anything as long as the policy is not changed. Only modify privately in Japan.

siebrand

siebrand

2008-09-10 17:15

developer   ~0019363

Please retest this with Mantis 1.2.0a2. As it now uses UTF-8, this issue should be resolved.

siebrand

siebrand

2009-03-30 18:49

developer   ~0021307

In git trunk Extended Unix Code is no longer supported in favour of Unicode/UTF-8.