diff -u -r b2evolution.orig/blogs/admin/tools.php b2evolution/blogs/admin/tools.php
--- b2evolution.orig/blogs/admin/tools.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/admin/tools.php	2006-05-20 21:47:22 +0900
@@ -28,14 +28,14 @@
 	{
 		?>
 		<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
-		<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $admin_url ?>/b2bookmarklet.php?text='+escape(Q)+'&amp;popupurl='+escape(location.href)+'&amp;popuptitle='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
+		<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $admin_url ?>/b2bookmarklet.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
 		<?php
 	}
 	elseif ($is_winIE)
 	{
 		?>
 		<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
-		<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $admin_url ?>/b2bookmarklet.php?text='+escape(Q)+'&amp;popupurl='+escape(location.href)+'&amp;popuptitle='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));btw.focus();"><?php echo T_('b2evo bookmarklet') ?></a>
+		<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $admin_url ?>/b2bookmarklet.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));btw.focus();"><?php echo T_('b2evo bookmarklet') ?></a>
 		</p>
 		<?php
 	}
@@ -43,14 +43,14 @@
 	{
 		?>
 		<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
-		<a href="javascript:void(window.open('<?php echo $admin_url ?>/b2bookmarklet.php?popupurl='+escape(location.href)+'&amp;popuptitle='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
+		<a href="javascript:void(window.open('<?php echo $admin_url ?>/b2bookmarklet.php?popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
 		<?php
 	}
 	elseif($is_macIE)
 	{
 		?>
 		<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
-		<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $admin_url ?>/b2bookmarklet.php?text='+escape(document.getSelection())+'&amp;popupurl='+escape(location.href)+'&amp;popuptitle='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));btw.focus();"><?php echo T_('b2evo bookmarklet') ?></a></p>
+		<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $admin_url ?>/b2bookmarklet.php?text='+encodeURIComponent(document.getSelection())+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));btw.focus();"><?php echo T_('b2evo bookmarklet') ?></a></p>
 		<?php
 	}
 	?>
@@ -84,7 +84,7 @@
 		<div class="panelblock">
 			<h2><?php echo T_('SideBar') ?></h2>
 			<p><?php echo T_('Add this link to your favorites:') ?><br />
-			<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo $admin_url ?>/b2sidebar.php?popuptitle='+escape(document.title)+'&amp;popupurl='+escape(location.href)+'&amp;text='+escape(Q),'_search'))"><?php echo T_('b2evo sidebar') ?></a></p>
+			<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo $admin_url ?>/b2sidebar.php?popuptitle='+encodeURIComponent(document.title)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;text='+encodeURIComponent(Q),'_search'))"><?php echo T_('b2evo sidebar') ?></a></p>
 		</div>
 		<?php
 	}
diff -u -r b2evolution.orig/blogs/b2evocore/_class_htmlchecker.php b2evolution/blogs/b2evocore/_class_htmlchecker.php
--- b2evolution.orig/blogs/b2evocore/_class_htmlchecker.php	2006-05-15 21:54:40 +0900
+++ b2evolution/blogs/b2evocore/_class_htmlchecker.php	2006-05-20 21:47:22 +0900
@@ -112,6 +112,7 @@
 				$this->encoding = 'UTF-8';
 
 				// Convert XHTML:
+				mb_internal_encoding( locale_charset(false) );
 				$xhtml = mb_convert_encoding( $xhtml, 'UTF-8' );
 			}
 		}
diff -u -r b2evolution.orig/blogs/b2evocore/_functions.php b2evolution/blogs/b2evocore/_functions.php
--- b2evolution.orig/blogs/b2evocore/_functions.php	2006-05-15 21:54:02 +0900
+++ b2evolution/blogs/b2evocore/_functions.php	2006-05-20 21:47:22 +0900
@@ -1331,7 +1331,7 @@
 	}
 
 	// Specify charset and content-type of email
-	$headers[] = 'Content-Type: text/plain; charset='.$locales[ $current_locale ]['charset'];
+//	$headers[] = 'Content-Type: text/plain; charset='.$locales[ $current_locale ]['charset'];
 	$headers[] = 'X-Mailer: b2evolution '.$b2_version.' - PHP/'.phpversion();
 
 	// -- build headers ----
@@ -1351,6 +1351,9 @@
 
 	debug_log( "Sending mail from $from to $to - subject $subject." );
 
-	return @mail( $to, $subject, $message, $headerstring );
+	$message = str_replace("\r\n", "\n", $message);
+	mb_language('Japanese');
+	mb_detect_order( $locales[ $current_locale ]['charset'] );
+	return @mb_send_mail( $to, $subject, $message, $headerstring );
 }
 ?>
\ No newline at end of file
diff -u -r b2evolution.orig/blogs/b2evocore/_functions_hitlogs.php b2evolution/blogs/b2evocore/_functions_hitlogs.php
--- b2evolution.orig/blogs/b2evocore/_functions_hitlogs.php	2005-09-20 19:16:02 +0900
+++ b2evolution/blogs/b2evocore/_functions_hitlogs.php	2006-05-20 21:47:22 +0900
@@ -478,18 +478,23 @@
 		if( $param_parts[0] == 'q' or $param_parts[0] == 'query' or $param_parts[0] == 'p' or $param_parts[0] == 'kw' or $param_parts[0] == 'qs' )
 		{ // found "q" query parameter
 			$q = urldecode($param_parts[1]);
-			if( strpos( $q, 'Ã' ) !== false )
+			if ( ( locale_charset(false) == 'iso-8859-1' ) && ( strpos( $q, "\xC3" ) !== false ) )
 			{	// Probability that the string is UTF-8 encoded is very high, that'll do for now...
 				//echo "[UTF-8 decoding]";
 				$q = utf8_decode( $q );
 			}
+			else if( ( locale_lang(false) == 'ja-JP' ) && function_exists('mb_convert_encoding') )
+			{
+				$q = mb_convert_encoding($q, locale_charset(false), 'ASCII,JIS,UTF-8,EUC-JP,SJIS');
+			}
 			$qwords = explode( ' ', $q );
 			foreach( $qwords as $qw )
 			{	
 				if( strlen( $qw ) > 30 ) $qw = substr( $qw, 0, 30 )."...";	// word too long, crop it
 				$kwout .= $qw.' ';
 			}
-			echo htmlentities($kwout);
+			$kwout = str_replace("\x00", '', $kwout);
+			echo htmlspecialchars($kwout);
 			return;
 		}
 	}
diff -u -r b2evolution.orig/blogs/b2evocore/_functions_template.php b2evolution/blogs/b2evocore/_functions_template.php
--- b2evolution.orig/blogs/b2evocore/_functions_template.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/b2evocore/_functions_template.php	2006-05-20 21:47:22 +0900
@@ -65,6 +65,17 @@
 		}
 
 
+		if (locale_lang(false) == 'ja-JP') {
+			$title = $prefix.$my_year.'&#24180;'.$my_month;
+			if( !empty( $my_day ) )
+			{ // We also want to display a day
+				$title .= $my_day.'&#26085;';
+			}
+			if( !empty($w) && ($w>=0) ) // Note: week # can be 0
+			{ // We also want to display a week number
+				$title .= ', &#31532;'.$w.'&#36913;';
+			}
+		} else {
 		$title = $prefix.$my_month.' '.$my_year;
 
 		if( !empty( $my_day ) )
@@ -77,6 +88,7 @@
 			$title .= ", week $w";
 		}
 
+		}
 		echo format_to_output( $title, $display );
 	}
 }
diff -u -r b2evolution.orig/blogs/b2evocore/_functions_trackback.php b2evolution/blogs/b2evocore/_functions_trackback.php
--- b2evolution.orig/blogs/b2evocore/_functions_trackback.php	2005-12-26 20:58:04 +0900
+++ b2evolution/blogs/b2evocore/_functions_trackback.php	2006-05-20 21:48:30 +0900
@@ -64,7 +64,8 @@
 	$Item = $ItemCache->get_by_ID( $ID );
 	$url = rawurlencode( $Item->gen_permalink('', '', false, '&') );
 	// dis is the trackback stuff to be sent:
-	$query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt";
+	$charset = urlencode( locale_charset(false) );
+	$query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt&charset=$charset";
 	// echo "url:$trackback_url<br>$sending:$query_string<br />";
 	if (strstr($trackback_url, '?'))
 	{
@@ -91,7 +92,7 @@
 		$port = isset($trackback_url['port']) ? $trackback_url['port'] : 80;
 		$http_request  = 'POST '.$trackback_url['path']." HTTP/1.0\r\n";
 		$http_request .= 'Host: '.$trackback_url['host']."\r\n";
-		$http_request .= 'Content-Type: application/x-www-form-urlencoded'."\r\n";
+		$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n";
 		$http_request .= 'Content-Length: '.strlen($query_string)."\r\n";
 		$http_request .= "\r\n";
 		$http_request .= $query_string;
diff -u -r b2evolution.orig/blogs/conf/_locales.php b2evolution/blogs/conf/_locales.php
--- b2evolution.orig/blogs/conf/_locales.php	2006-05-02 21:47:32 +0900
+++ b2evolution/blogs/conf/_locales.php	2006-05-20 21:47:22 +0900
@@ -356,7 +356,7 @@
  *
  * @global int $start_of_week
  */
-$start_of_week = 1;
+$start_of_week = 0;
 
 
 /**
diff -u -r b2evolution.orig/blogs/htsrv/trackback.php b2evolution/blogs/htsrv/trackback.php
--- b2evolution.orig/blogs/htsrv/trackback.php	2006-04-20 19:42:26 +0900
+++ b2evolution/blogs/htsrv/trackback.php	2006-05-20 21:47:22 +0900
@@ -46,6 +46,38 @@
 		trackback_response( 1, 'Sorry, this item does not accept comments.' );
 	}
 
+	param( 'charset', 'string', NULL );
+	if ( ($_SERVER['CONTENT_TYPE'] != '') && ($charset == '') )
+	{
+		$request_header_content_type = array();
+		preg_match( '/;[ \r\n\t]*charset="?([A-Za-z0-9_\-]+)/i', $_SERVER['CONTENT_TYPE'], $request_header_content_type );
+		if ( $request_header_content_type[1] != '' )
+			$charset = $request_header_content_type[1];
+	}
+	locale_temp_switch( get_bloginfo('locale', $blogparams) );
+	if ( ($charset != '') && function_exists('iconv') )
+	{
+		$to_charset = locale_charset(false);
+		$title = iconv( $charset, $to_charset, $title );
+		$excerpt = iconv( $charset, $to_charset, $excerpt );
+		$blog_name = iconv( $charset, $to_charset, $blog_name );
+	}
+	elseif ( function_exists('mb_convert_encoding') )
+	{
+		if ( ($charset == '') && ( locale_lang(false) == 'ja-JP') )
+		{
+			$charset = mb_detect_encoding( $title . $excerpt . $blog_name, 'ASCII,JIS,UTF-8,EUC-JP,SJIS');
+		}
+		if ( $charset != '' )
+		{
+			$to_charset = locale_charset(false);
+			$title = mb_convert_encoding( $title, $to_charset, $charset );
+			$excerpt = mb_convert_encoding( $excerpt, $to_charset, $charset );
+			$blog_name = mb_convert_encoding( $blog_name, $to_charset, $charset );
+		}
+	}
+	locale_restore_previous();
+
 	$title = strip_tags($title);
 	$title = (strlen($title) > 255) ? substr($title, 0, 252).'...' : $title;
 	$excerpt = strip_tags($excerpt);
diff -u -r b2evolution.orig/blogs/skins/_archives.php b2evolution/blogs/skins/_archives.php
--- b2evolution.orig/blogs/skins/_archives.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/skins/_archives.php	2006-05-20 21:47:22 +0900
@@ -53,7 +53,11 @@
 				echo '<a href="';
 				archive_link( $arc_year, $arc_month );
 				echo '">';
-				echo T_($month[zeroise($arc_month,2)]),' ',$arc_year;
+				if (locale_lang(false) == 'ja-JP') {
+					echo $arc_year,'&#24180;',T_($month[zeroise($arc_month,2)]);
+				} else {
+					echo T_($month[zeroise($arc_month,2)]),' ',$arc_year;
+				}
 				echo '</a> <span class="dimmed">('.$arc_count.')</span>';
 				break;
 	
diff -u -r b2evolution.orig/blogs/skins/_calendar.php b2evolution/blogs/skins/_calendar.php
--- b2evolution.orig/blogs/skins/_calendar.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/skins/_calendar.php	2006-05-20 21:47:22 +0900
@@ -22,6 +22,9 @@
 	# Uncomment the lines you need
 
 	// $Calendar->set( 'displaycaption', 1 ); // set this to 0 if you don't want to display the month name
+	if (locale_lang(false) == 'ja-JP') {
+		$Calendar->set( 'monthformat', 'Y&#24180;F' );
+	}
 	// $Calendar->set( 'monthformat', 'F Y' );
 
 	// $Calendar->set( 'tablestart', '<table class="bCalendarTable" summary="Monthly calendar with links to each day\'s posts">' );
diff -u -r b2evolution.orig/blogs/skins/custom/_calendar.php b2evolution/blogs/skins/custom/_calendar.php
--- b2evolution.orig/blogs/skins/custom/_calendar.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/skins/custom/_calendar.php	2006-05-20 21:47:22 +0900
@@ -22,6 +22,9 @@
 	// $Calendar->set( 'searchframe', 12 );	// How many month will we search back for a post before we give up
 
 	// $Calendar->set( 'displaycaption', 1 ); // set this to 0 if you don't want to display the month name
+	if (locale_lang(false) == 'ja-JP') {
+		$Calendar->set( 'monthformat', 'Y&#24180;F' );
+	}
 	// $Calendar->set( 'monthformat', 'F Y' );
 	// $Calendar->set( 'monthstart', '<caption class="bCalendarCaption">' );
 	// $Calendar->set( 'monthend', '</caption>' );
diff -u -r b2evolution.orig/blogs/skins/natural_pink/_calendar.php b2evolution/blogs/skins/natural_pink/_calendar.php
--- b2evolution.orig/blogs/skins/natural_pink/_calendar.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/skins/natural_pink/_calendar.php	2006-05-20 21:47:22 +0900
@@ -22,6 +22,9 @@
 	// $Calendar->set( 'searchframe', 12 );	// How many month will we search back for a post before we give up
 
 	// $Calendar->set( 'displaycaption', 1 ); // set this to 0 if you don't want to display the month name
+	if (locale_lang(false) == 'ja-JP') {
+		$Calendar->set( 'monthformat', 'Y&#24180;F' );
+	}
 	// $Calendar->set( 'monthformat', 'F Y' );
 	// $Calendar->set( 'monthstart', '<caption class="bCalendarCaption">' );
 	// $Calendar->set( 'monthend', '</caption>' );
diff -u -r b2evolution.orig/blogs/skins/wpc_aubmach/_calendar.php b2evolution/blogs/skins/wpc_aubmach/_calendar.php
--- b2evolution.orig/blogs/skins/wpc_aubmach/_calendar.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/skins/wpc_aubmach/_calendar.php	2006-05-20 21:47:22 +0900
@@ -22,6 +22,9 @@
 	// $Calendar->set( 'searchframe', 12 );	// How many month will we search back for a post before we give up
 
 	// $Calendar->set( 'displaycaption', 1 ); // set this to 0 if you don't want to display the month name
+	if (locale_lang(false) == 'ja-JP') {
+		$Calendar->set( 'monthformat', 'Y&#24180;F' );
+	}
 	// $Calendar->set( 'monthformat', 'F Y' );
 	$Calendar->set( 'linktomontharchive', false );
 	$Calendar->set( 'monthstart', '<caption>' );
diff -u -r b2evolution.orig/blogs/skins/wpc_default/_calendar.php b2evolution/blogs/skins/wpc_default/_calendar.php
--- b2evolution.orig/blogs/skins/wpc_default/_calendar.php	2005-09-13 15:25:06 +0900
+++ b2evolution/blogs/skins/wpc_default/_calendar.php	2006-05-20 21:47:22 +0900
@@ -22,6 +22,9 @@
 	// $Calendar->set( 'searchframe', 12 );	// How many month will we search back for a post before we give up
 
 	// $Calendar->set( 'displaycaption', 1 ); // set this to 0 if you don't want to display the month name
+	if (locale_lang(false) == 'ja-JP') {
+		$Calendar->set( 'monthformat', 'Y&#24180;F' );
+	}
 	// $Calendar->set( 'monthformat', 'F Y' );
 	$Calendar->set( 'linktomontharchive', false );
 	$Calendar->set( 'monthstart', '<caption>' );
