diff -Naru -x '*~' /home/httpd/html/moodle.orig/auth/ldap/lib.php /home/httpd/html/moodle/auth/ldap/lib.php
--- /home/httpd/html/moodle.orig/auth/ldap/lib.php	2005-06-06 14:18:23.000000000 +0900
+++ /home/httpd/html/moodle/auth/ldap/lib.php	2005-09-25 00:13:55.000000000 +0900
@@ -68,7 +68,9 @@
         }
 
         // Try to bind with current username and password
-        $ldap_login = @ldap_bind($ldapconnection, $ldap_user_dn, $password);
+//      $ldap_login = @ldap_bind($ldapconnection, $ldap_user_dn, $password);
+	// t-kita2005-09-24
+        $ldap_login = @ldap_bind($ldapconnection, $ldap_user_dn, stripslashes($password));
         ldap_close($ldapconnection);
         if ($ldap_login) {
             return true;
diff -Naru -x '*~' /home/httpd/html/moodle.orig/backup/backuplib.php /home/httpd/html/moodle/backup/backuplib.php
--- /home/httpd/html/moodle.orig/backup/backuplib.php	2005-07-13 11:16:28.000000000 +0900
+++ /home/httpd/html/moodle/backup/backuplib.php	2005-09-25 00:13:55.000000000 +0900
@@ -1650,7 +1650,7 @@
         }
 
         if ($result != $content && $CFG->debug>7) {                                  //Debug
-            echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';        //Debug
+            echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';        //Debug
         }                                                                            //Debug
 
         return $result;
diff -Naru -x '*~' /home/httpd/html/moodle.orig/backup/restorelib.php /home/httpd/html/moodle/backup/restorelib.php
--- /home/httpd/html/moodle.orig/backup/restorelib.php	2005-07-13 11:16:28.000000000 +0900
+++ /home/httpd/html/moodle/backup/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -2182,7 +2182,7 @@
         $result = str_replace($search,$replace,$content);
 
         if ($result != $content && $CFG->debug>7) {                                  //Debug
-            echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';        //Debug
+            echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';        //Debug
         }                                                                            //Debug
 
         return $result;
diff -Naru -x '*~' /home/httpd/html/moodle.orig/filter/mediaplugin/filter.php /home/httpd/html/moodle/filter/mediaplugin/filter.php
--- /home/httpd/html/moodle.orig/filter/mediaplugin/filter.php	2005-06-06 14:18:42.000000000 +0900
+++ /home/httpd/html/moodle/filter/mediaplugin/filter.php	2005-09-25 00:13:55.000000000 +0900
@@ -28,7 +28,7 @@
                 $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&waitForPlay=yes&';
             }
         }
-        $c = htmlentities($c);
+        $c = htmlentities($c,ENT_COMPAT,get_string('thischarset','moodle'));
         $search = '/<a(.*?)href=\"([^<]+)\.mp3\"([^>]*)>(.*?)<\/a>/i';
 
         $replace  = '\\0&nbsp;<object class="mediaplugin mp3" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
diff -Naru -x '*~' /home/httpd/html/moodle.orig/filter/tex/displaytex.php /home/httpd/html/moodle/filter/tex/displaytex.php
--- /home/httpd/html/moodle.orig/filter/tex/displaytex.php	2005-05-24 15:04:05.000000000 +0900
+++ /home/httpd/html/moodle/filter/tex/displaytex.php	2005-09-25 00:13:55.000000000 +0900
@@ -5,7 +5,7 @@
     // entities are usually encoded twice, first in HTML editor then in tex/filter.php
     $texexp = html_entity_decode(html_entity_decode($texexp));
     // encode all entities
-    $texexp = htmlentities($texexp);
+    $texexp = htmlentities($texexp,ENT_COMPAT,get_string('thischarset','moodle'));
 ?>
 <html>
   <head>
diff -Naru -x '*~' /home/httpd/html/moodle.orig/install.php /home/httpd/html/moodle/install.php
--- /home/httpd/html/moodle.orig/install.php	2005-05-24 15:03:52.000000000 +0900
+++ /home/httpd/html/moodle/install.php	2005-09-25 00:13:55.000000000 +0900
@@ -415,7 +415,7 @@
 
         echo "<hr />\n";
         echo "<div style=\"text-align: left\">\n";
-        print_object(htmlentities($str));
+        print_object(htmlentities($str,ENT_COMPAT,get_string('thischarset','moodle')));
         echo "</div>\n";
     }
 } else {
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/adodb/adodb-xmlschema.inc.php /home/httpd/html/moodle/lib/adodb/adodb-xmlschema.inc.php
--- /home/httpd/html/moodle.orig/lib/adodb/adodb-xmlschema.inc.php	2005-05-24 15:06:47.000000000 +0900
+++ /home/httpd/html/moodle/lib/adodb/adodb-xmlschema.inc.php	2005-09-25 00:13:55.000000000 +0900
@@ -1841,7 +1841,7 @@
 					   . '<table>' . "\n";
 		
 		foreach( $msg as $label => $details ) {
-			$error_details .= '<tr><td><b>' . $label . ': </b></td><td>' . htmlentities( $details ) . '</td></tr>' . "\n";
+			$error_details .= '<tr><td><b>' . $label . ': </b></td><td>' . htmlentities( $details ,ENT_COMPAT,get_string('thischarset','moodle')) . '</td></tr>' . "\n";
 		}
 		
 		$error_details .= '</table>';
@@ -1983,7 +1983,7 @@
 						
 						while( $row = $rs->FetchRow() ) {
 							foreach( $row as $key => $val ) {
-								$row[$key] = htmlentities($val);
+								$row[$key] = htmlentities($val,ENT_COMPAT,get_string('thischarset','moodle'));
 							}
 							
 							$schema .= '			<row><f>' . implode( '</f><f>', $row ) . '</f></row>' . "\n";
@@ -2151,7 +2151,7 @@
 			case 'text':
 				return !empty( $sqlArray ) ? implode( ";\n\n", $sqlArray ) . ';' : '';
 			case'html':
-				return !empty( $sqlArray ) ? nl2br( htmlentities( implode( ";\n\n", $sqlArray ) . ';' ) ) : '';
+				return !empty( $sqlArray ) ? nl2br( htmlentities( implode( ";\n\n", $sqlArray ) . ';' ,ENT_COMPAT,get_string('thischarset','moodle')) ) : '';
 		}
 		
 		return $this->sqlArray;
@@ -2179,7 +2179,7 @@
 		echo '<pre>';
 		
 		if( isset( $title ) ) {
-			echo '<h3>' . htmlentities( $title ) . '</h3>';
+			echo '<h3>' . htmlentities( $title ,ENT_COMPAT,get_string('thischarset','moodle')) . '</h3>';
 		}
 		
 		if( is_object( $this ) ) {
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/cas/CAS.php /home/httpd/html/moodle/lib/cas/CAS.php
--- /home/httpd/html/moodle.orig/lib/cas/CAS.php	2005-03-12 02:13:28.000000000 +0900
+++ /home/httpd/html/moodle/lib/cas/CAS.php	2005-09-25 00:13:55.000000000 +0900
@@ -457,7 +457,7 @@
 	  }
 	}
       }
-      echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>".__CLASS__."::".$function.'(): '.htmlentities($msg)."</b></font> in <b>".$file."</b> on line <b>".$line."</b><br />\n";
+      echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>".__CLASS__."::".$function.'(): '.htmlentities($msg,ENT_COMPAT,get_string('thischarset','moodle'))."</b></font> in <b>".$file."</b> on line <b>".$line."</b><br />\n";
       phpCAS::trace($msg);
       phpCAS::traceExit();
       exit();
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/cas/client.php /home/httpd/html/moodle/lib/cas/client.php
--- /home/httpd/html/moodle.orig/lib/cas/client.php	2005-03-12 02:13:29.000000000 +0900
+++ /home/httpd/html/moodle/lib/cas/client.php	2005-09-25 00:13:55.000000000 +0900
@@ -497,7 +497,7 @@
 	} 
 	// ill-formed ticket, halt
 	else if ( !empty($ticket) ) {
-	  phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket).'\')');
+	  phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket,ENT_COMPAT,get_string('thischarset','moodle')).'\')');
 	}
 	// ticket has been taken into account, unset it to hide it to applications
 	unset($_GET['ticket']);
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/excel/Workbook.php /home/httpd/html/moodle/lib/excel/Workbook.php
--- /home/httpd/html/moodle.orig/lib/excel/Workbook.php	2004-04-16 00:41:06.000000000 +0900
+++ /home/httpd/html/moodle/lib/excel/Workbook.php	2005-10-13 22:34:43.000000000 +0900
@@ -357,7 +357,11 @@
     
         // Add BOUNDSHEET records
         for($i=0; $i < count($this->worksheets); $i++) {
-            $this->_store_boundsheet($this->worksheets[$i]->name,$this->worksheets[$i]->offset);
+//            $this->_store_boundsheet($this->worksheets[$i]->name,$this->worksheets[$i]->offset);
+              // t-kita 20051013
+              if (function_exists('use_lang_lib') && use_lang_lib() && define_usr_agent()) {
+                   $this->_store_boundsheet( ex_convert_encoding($this->worksheets[$i]->name,'shift_jis','auto') ,$this->worksheets[$i]->offset);
+              }
         }
     
         // End Workbook globals
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/excel/Worksheet.php /home/httpd/html/moodle/lib/excel/Worksheet.php
--- /home/httpd/html/moodle.orig/lib/excel/Worksheet.php	2003-09-26 13:18:02.000000000 +0900
+++ /home/httpd/html/moodle/lib/excel/Worksheet.php	2005-10-13 22:28:25.000000000 +0900
@@ -1040,6 +1040,12 @@
     */
     function write_string($row, $col, $str, $format = 0)
     {
+
+        // t-kita 20051013
+        if (function_exists('use_lang_lib') && use_lang_lib() && define_usr_agent()) {
+             $str = ex_convert_encoding($str, 'shift_jis', 'auto');
+        }
+
         $strlen    = strlen($str);
         $record    = 0x0204;                   // Record identifier
         $length    = 0x0008 + $strlen;         // Bytes to follow
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/filelib.php /home/httpd/html/moodle/lib/filelib.php
--- /home/httpd/html/moodle.orig/lib/filelib.php	2005-07-13 11:17:50.000000000 +0900
+++ /home/httpd/html/moodle/lib/filelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -198,7 +198,7 @@
         } else if ($mimetype == 'text/plain') {
             $options->newlines = false;
             $options->noclean = true;
-            $text = htmlentities($pathisstring ? $path : implode('', file($path)));
+            $text = htmlentities($pathisstring ? $path : implode('', file($path)),ENT_COMPAT,get_string('thischarset','moodle'));
             $output = '<pre>'. format_text($text, FORMAT_MOODLE, $options, $courseid) .'</pre>';
 
             @header('Content-length: '.strlen($output));
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/moodlelib.php /home/httpd/html/moodle/lib/moodlelib.php
--- /home/httpd/html/moodle.orig/lib/moodlelib.php	2005-09-24 14:09:58.000000000 +0900
+++ /home/httpd/html/moodle/lib/moodlelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -3537,6 +3537,11 @@
         }
     }
 
+    // t-kita2005-07-17
+    if (function_exists('use_lang_lib') && use_lang_lib()) {
+        email_encoding($mail);
+    }
+
     if ($mail->Send()) {
         set_send_count($user);
         return true;
@@ -5337,6 +5342,13 @@
             set_config('locale', $CFG->locale);                 // Cache it to save lookups in future
         }
     }
+
+    // t-kita2005-07-17
+    $currlang = current_language();
+    if ($currlang != 'en') {
+        setlocale (LC_ALL, $CFG->locale);
+    }
+
     setlocale (LC_TIME, $CFG->locale);
     setlocale (LC_COLLATE, $CFG->locale);
 
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/setup.php /home/httpd/html/moodle/lib/setup.php
--- /home/httpd/html/moodle.orig/lib/setup.php	2005-09-24 14:09:58.000000000 +0900
+++ /home/httpd/html/moodle/lib/setup.php	2005-09-25 00:13:55.000000000 +0900
@@ -405,6 +405,13 @@
         }
     }
 
+/// Load up Language Library by Takahito Kashiwagi  t-kita2005-07-17
+    $currlang = current_language();
+    if (file_exists("$CFG->dirroot/lang/$currlang/lib/langlib.php")) {
+        require_once("$CFG->dirroot/lang/$currlang/lib/langlib.php");
+    }
+
+
     if ($CFG->theme == 'standard' or $CFG->theme == 'standardwhite') {    // Temporary measure to help with XHTML validation
         if (empty($_SESSION['USER']->id)) {      // Allow W3CValidator in as user called w3cvalidator (or guest)
             if ((strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) or
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/validateurlsyntax.php /home/httpd/html/moodle/lib/validateurlsyntax.php
--- /home/httpd/html/moodle.orig/lib/validateurlsyntax.php	2005-05-24 15:06:47.000000000 +0900
+++ /home/httpd/html/moodle/lib/validateurlsyntax.php	2005-09-25 00:13:55.000000000 +0900
@@ -312,7 +312,7 @@
     $regexp = '^' . $scheme . $userinfo . $address . $port_number . $path . $querystring . $fragment . '$';
     
     // DEBUGGING - Uncomment Line Below To Display The Regular Expression Built
-    // echo '<pre>' . htmlentities(wordwrap($regexp,70,"\n",1)) . '</pre>';
+    // echo '<pre>' . htmlentities(wordwrap($regexp,70,"\n",1),ENT_COMPAT,get_string('thischarset','moodle')) . '</pre>';
 
     // Running the regular expression
     if (eregi( $regexp, $urladdr ))
diff -Naru -x '*~' /home/httpd/html/moodle.orig/lib/weblib.php /home/httpd/html/moodle/lib/weblib.php
--- /home/httpd/html/moodle.orig/lib/weblib.php	2005-07-15 11:10:35.000000000 +0900
+++ /home/httpd/html/moodle/lib/weblib.php	2005-11-14 08:59:53.000000000 +0900
@@ -1100,7 +1100,7 @@
             break;
 
         case FORMAT_PLAIN:
-            $text = htmlentities($text);
+            $text = htmlentities($text,ENT_COMPAT,get_string('thischarset','moodle'));
             $text = rebuildnolinktag($text);
             $text = str_replace('  ', '&nbsp; ', $text);
             $text = nl2br($text);
@@ -3479,9 +3479,16 @@
     for ($i=2000; $i<=2010; $i++) {
         $years[$i] = $i;
     }
-    choose_from_menu($days,   $day,   $currentdate['mday'], '');
-    choose_from_menu($months, $month, $currentdate['mon'],  '');
-    choose_from_menu($years,  $year,  $currentdate['year'], '');
+
+    if (in_array(substr(current_language(),0,2), array('ja'))) {
+        choose_from_menu($years,  $year,  $currentdate['year'], '');
+        choose_from_menu($months, $month, $currentdate['mon'],  '');
+        choose_from_menu($days,   $day,   $currentdate['mday'], '');
+    }else{
+        choose_from_menu($days,   $day,   $currentdate['mday'], '');
+        choose_from_menu($months, $month, $currentdate['mon'],  '');
+        choose_from_menu($years,  $year,  $currentdate['year'], '');
+    }
 }
 
 /**
@@ -3703,7 +3710,7 @@
     $linkobject .= '</span>';
 
     if ($text) {
-        $url = '/help.php?module='. $module .'&amp;text='. htmlentities(urlencode($text));
+        $url = '/help.php?module='. $module .'&amp;text='. htmlentities(urlencode($text),ENT_COMPAT,get_string('thischarset','moodle'));
     } else {
         $url = '/help.php?module='. $module .'&amp;file='. $page .'.html';
     }
@@ -3812,7 +3819,7 @@
 
     $url = html_entity_decode($url); // for php < 4.3.0 this is defined in moodlelib.php
     $url = str_replace(array("\n", "\r"), '', $url); // some more cleaning
-    $encodedurl = htmlentities($url);
+    $encodedurl = htmlentities($url,ENT_COMPAT,get_string('thischarset','moodle'));
 
     if (empty($message)) {
         echo '<meta http-equiv="refresh" content="'. $delay .'; url='. $encodedurl .'" />';
diff -Naru -x '*~' /home/httpd/html/moodle.orig/login/confirm.php /home/httpd/html/moodle/login/confirm.php
--- /home/httpd/html/moodle.orig/login/confirm.php	2005-09-24 14:09:58.000000000 +0900
+++ /home/httpd/html/moodle/login/confirm.php	2005-09-25 00:13:55.000000000 +0900
@@ -11,7 +11,11 @@
 
             if ($user->confirmed) {
                 print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), "", "");
+		if (current_language() == 'ja') { // t-kita2005-07-17
+                echo "<center><h3>".get_string("thanks").", ". fullname($user) . " さん。</h3>\n";
+		}else{
                 echo "<center><h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
+		}
                 echo "<h4>".get_string("alreadyconfirmed")."</h4>\n";
                 echo "<h3> -> <a href=\"$CFG->wwwroot/course/\">".get_string("courses")."</a></h3></center>\n";
                 print_footer();
@@ -47,7 +51,11 @@
                 }
  
                 print_header(get_string("confirmed"), get_string("confirmed"), "", "");
+		if (current_language() == 'ja') { // t-kita2005-07-17
+                echo "<center><h3>".get_string("thanks").", ". fullname($USER) . " さん。</h3>\n";
+		}else{	
                 echo "<center><h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
+		}
                 echo "<h4>".get_string("confirmed")."</h4>\n";
                 echo "<h3> -> <a href=\"$CFG->wwwroot/course/\">".get_string("courses")."</a></h3></center>\n";
                 print_footer();
diff -Naru -x '*~' /home/httpd/html/moodle.orig/login/signup_form.html /home/httpd/html/moodle/login/signup_form.html
--- /home/httpd/html/moodle.orig/login/signup_form.html	2005-05-24 15:07:11.000000000 +0900
+++ /home/httpd/html/moodle/login/signup_form.html	2005-11-14 00:17:27.000000000 +0900
@@ -60,18 +60,38 @@
     <?php if (!empty($err->email2)) { formerr($err->email2); } ?>
     </td>
 </tr>
-<tr valign="top">
+
+<?php 
+$nameordercheck->firstname = "a";
+$nameordercheck->lastname  = "b";
+if ( fullname($nameordercheck) == "b a" ){ ?>
+  <tr valign="top">
+    <td align="right"><?php print_string("lastname") ?>:</td>
+    <td><input type="text" name="lastname" size="25" value="<?php p($user->lastname) ?>" alt="<?php print_string("lastname") ?>" />
+    <?php if (!empty($err->lastname)) { formerr($err->lastname);} ?>
+    </td>
+  </tr>
+  <tr valign="top">
     <td align="right"><?php print_string("firstname") ?>:</td>
     <td><input type="text" name="firstname" size="25" value="<?php p($user->firstname) ?>" alt="<?php print_string("firstname") ?>" />
     <?php if (!empty($err->firstname)) { formerr($err->firstname);} ?>
     </td>
-</tr>
-<tr valign="top">
+  </tr>
+<?php }else{ ?>
+  <tr valign="top">
+    <td align="right"><?php print_string("firstname") ?>:</td>
+    <td><input type="text" name="firstname" size="25" value="<?php p($user->firstname) ?>" alt="<?php print_string("firstname") ?>" />
+    <?php if (!empty($err->firstname)) { formerr($err->firstname);} ?>
+    </td>
+  </tr>
+  <tr valign="top">
     <td align="right"><?php print_string("lastname") ?>:</td>
     <td><input type="text" name="lastname" size="25" value="<?php p($user->lastname) ?>" alt="<?php print_string("lastname") ?>" />
     <?php if (!empty($err->lastname)) { formerr($err->lastname);} ?>
     </td>
-</tr>
+  </tr>
+<?php } ?>
+
 <tr valign="top">
     <td align="right"><?php print_string("city") ?>:</td>
     <td><input type="text" name="city" size="25" value="<?php p($user->city) ?>" alt="<?php print_string("city") ?>" />
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/assignment/restorelib.php /home/httpd/html/moodle/mod/assignment/restorelib.php
--- /home/httpd/html/moodle.orig/mod/assignment/restorelib.php	2005-07-13 11:17:54.000000000 +0900
+++ /home/httpd/html/moodle/mod/assignment/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -319,7 +319,7 @@
                     $assignment->description = addslashes($result);
                     $status = update_record("assignment",$assignment);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/chat/restorelib.php /home/httpd/html/moodle/mod/chat/restorelib.php
--- /home/httpd/html/moodle.orig/mod/chat/restorelib.php	2005-07-13 11:17:54.000000000 +0900
+++ /home/httpd/html/moodle/mod/chat/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -217,7 +217,7 @@
                     $chat->intro = addslashes($result);
                     $status = update_record("chat",$chat);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/choice/restorelib.php /home/httpd/html/moodle/mod/choice/restorelib.php
--- /home/httpd/html/moodle.orig/mod/choice/restorelib.php	2005-07-13 11:17:55.000000000 +0900
+++ /home/httpd/html/moodle/mod/choice/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -338,7 +338,7 @@
                     $choice->text = addslashes($result);
                     $status = update_record("choice",$choice);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/forum/restorelib.php /home/httpd/html/moodle/mod/forum/restorelib.php
--- /home/httpd/html/moodle.orig/mod/forum/restorelib.php	2005-07-13 11:17:55.000000000 +0900
+++ /home/httpd/html/moodle/mod/forum/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -984,7 +984,7 @@
                     $post->message = addslashes($result);
                     $status = update_record("forum_posts",$post);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
@@ -1014,7 +1014,7 @@
                     $forum->intro = addslashes($result);
                     $status = update_record("forum",$forum);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/glossary/restorelib.php /home/httpd/html/moodle/mod/glossary/restorelib.php
--- /home/httpd/html/moodle.orig/mod/glossary/restorelib.php	2005-07-13 11:17:55.000000000 +0900
+++ /home/httpd/html/moodle/mod/glossary/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -599,7 +599,7 @@
                     $entry->definition = addslashes($result);
                     $status = update_record("glossary_entries",$entry);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
@@ -629,7 +629,7 @@
                     $glossary->intro = addslashes($result);
                     $status = update_record("glossary",$glossary);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/label/restorelib.php /home/httpd/html/moodle/mod/label/restorelib.php
--- /home/httpd/html/moodle.orig/mod/label/restorelib.php	2005-07-13 11:17:56.000000000 +0900
+++ /home/httpd/html/moodle/mod/label/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -80,7 +80,7 @@
                     $label->content = addslashes($result);
                     $status = update_record("label", $label);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/lesson/restorelib.php /home/httpd/html/moodle/mod/lesson/restorelib.php
--- /home/httpd/html/moodle.orig/mod/lesson/restorelib.php	2005-07-13 11:17:56.000000000 +0900
+++ /home/httpd/html/moodle/mod/lesson/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -726,7 +726,7 @@
                     $page->contents = addslashes($result);
                     $status = update_record("lesson_pages",$page);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/quiz/format/examview/format.php /home/httpd/html/moodle/mod/quiz/format/examview/format.php
--- /home/httpd/html/moodle.orig/mod/quiz/format/examview/format.php	2005-06-06 14:19:32.000000000 +0900
+++ /home/httpd/html/moodle/mod/quiz/format/examview/format.php	2005-09-25 00:13:55.000000000 +0900
@@ -188,7 +188,7 @@
     function htmlPrepare($htmltext)
     {
         $text = trim($text);
-        $text = htmlentities($htmltext, ENT_QUOTES);
+        $text = htmlentities($htmltext, ENT_QUOTES, get_string('thischarset','moodle'));
         //$htmltext = nl2br($text);
         return $text;
     }
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/quiz/restorelib.php /home/httpd/html/moodle/mod/quiz/restorelib.php
--- /home/httpd/html/moodle.orig/mod/quiz/restorelib.php	2005-07-13 11:17:57.000000000 +0900
+++ /home/httpd/html/moodle/mod/quiz/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -1948,7 +1948,7 @@
                     $quiz->intro = addslashes($result);
                     $status = update_record("quiz",$quiz);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/resource/restorelib.php /home/httpd/html/moodle/mod/resource/restorelib.php
--- /home/httpd/html/moodle.orig/mod/resource/restorelib.php	2005-07-13 11:18:00.000000000 +0900
+++ /home/httpd/html/moodle/mod/resource/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -191,8 +191,8 @@
                     $resource->summary = addslashes($result2);
                     $status = update_record("resource",$resource);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content1).'<br />changed to<br />'.htmlentities($result1).'<hr /><br />';
-                        echo '<br /><hr />'.htmlentities($content2).'<br />changed to<br />'.htmlentities($result2).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content1,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result1,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content2,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result2,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/resource/type/file/resource.class.php /home/httpd/html/moodle/mod/resource/type/file/resource.class.php
--- /home/httpd/html/moodle.orig/mod/resource/type/file/resource.class.php	2005-05-24 15:07:23.000000000 +0900
+++ /home/httpd/html/moodle/mod/resource/type/file/resource.class.php	2005-09-25 00:13:55.000000000 +0900
@@ -276,7 +276,7 @@
 
         $relativeurl = str_replace('\\', '/', $relativeurl);
         $relativeurl = str_replace(' ', '%20', $relativeurl);
-        $fullurl = 'file:///'.htmlentities($relativeurl);
+        $fullurl = 'file:///'.htmlentities($relativeurl,ENT_COMPAT,get_string('thischarset','moodle'));
         $localpath = true;
 
     } else {   // Normal uploaded file
@@ -412,7 +412,7 @@
                      'font=Arial&fontColour=3333FF&buffer=10&waitForPlay=no&autoPlay=yes';
             }
             $c .= '&volText='.get_string('vol', 'resource').'&panText='.get_string('pan','resource');
-            $c = htmlentities($c);
+            $c = htmlentities($c,ENT_COMPAT,get_string('thischarset','moodle'));
             echo '<div class="mp3player" align="center">';
             echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
             echo '        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/scorm/restorelib.php /home/httpd/html/moodle/mod/scorm/restorelib.php
--- /home/httpd/html/moodle.orig/mod/scorm/restorelib.php	2005-07-13 11:18:00.000000000 +0900
+++ /home/httpd/html/moodle/mod/scorm/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -441,7 +441,7 @@
                     $scorm->summary = addslashes($result);
                     $status = update_record("scorm",$scorm);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/survey/restorelib.php /home/httpd/html/moodle/mod/survey/restorelib.php
--- /home/httpd/html/moodle.orig/mod/survey/restorelib.php	2005-07-13 11:18:00.000000000 +0900
+++ /home/httpd/html/moodle/mod/survey/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -281,7 +281,7 @@
                     $survey->intro = addslashes($result);
                     $status = update_record("survey",$survey);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/wiki/ewiki/ewiki.php /home/httpd/html/moodle/mod/wiki/ewiki/ewiki.php
--- /home/httpd/html/moodle.orig/mod/wiki/ewiki/ewiki.php	2005-05-24 15:07:45.000000000 +0900
+++ /home/httpd/html/moodle/mod/wiki/ewiki/ewiki.php	2005-09-25 00:13:55.000000000 +0900
@@ -75,7 +75,8 @@
 	define("EWIKI_UP_UPLOAD", "upload");
         #- other stuff
         define("EWIKI_DEFAULT_LANG", "en");
-        define("EWIKI_CHARSET", "ISO-8859-1");
+//        define("EWIKI_CHARSET", "ISO-8859-1");
+	define("EWIKI_CHARSET", get_string('thischarset','moodle')); 
 	#- user permissions
 	define("EWIKI_PROTECTED_MODE", 0);	# disable funcs + require auth
 	define("EWIKI_PROTECTED_MODE_HIDING", 0);  # hides disallowed actions
@@ -648,7 +649,7 @@
    if ($split) {
       $id = preg_replace("/([".EWIKI_CHARS_L."])([".EWIKI_CHARS_U."]+)/", "$1 $2", $id);
    }
-   return($entities ? htmlentities($id) : $id);
+   return($entities ? htmlentities($id,ENT_COMPAT,get_string('thischarset','moodle')) : $id);
 }
 
 
@@ -684,7 +685,7 @@
       $title = ewiki_split_title($title, $ewiki_config["split_title"], 0&($title!=$ewiki_title));
    }
    else {
-      $title = htmlentities($title);
+      $title = htmlentities($title,ENT_COMPAT,get_string('thischarset','moodle'));
    }
 
    #-- title mangling
@@ -995,7 +996,7 @@
          $add_text = "";
       }
 
-      $lines[] = '<a href="' . ewiki_script("", $id, $params) . '">' . htmlentities($title) . '</a> ' . $add_text;
+      $lines[] = '<a href="' . ewiki_script("", $id, $params) . '">' . htmlentities($title,ENT_COMPAT,get_string('thischarset','moodle')) . '</a> ' . $add_text;
 
       if (($limit > 0)  &&  ($n++ >= $limit)) {
          break;
@@ -1194,7 +1195,7 @@
             continue;  // MOODLE DOESN'T USE IT
             $str = "";
             if ($first && $value) { foreach ($value as $n=>$d) {
-               $str .= htmlentities("$n: $d") . "<br />\n";
+               $str .= htmlentities("$n: $d",ENT_COMPAT,get_string('thischarset','moodle')) . "<br />\n";
             } }
             $value = $str;
          }
@@ -1460,7 +1461,7 @@
                      #header("Refresh: 0; URL=$url");
                   }
                   else {
-                     $o .= '<meta http-equiv="Refresh" content="0; URL='.htmlentities($url).'">';
+                     $o .= '<meta http-equiv="Refresh" content="0; URL='.htmlentities($url,ENT_COMPAT,get_string('thischarset','moodle')).'">';
                   }
                }
 
@@ -1560,7 +1561,7 @@
    ##### END MOODLE ADDITION #####
 
      $o .= '<textarea wrap="soft" id="ewiki_content" name="content" rows="'.$rows.'" cols="'.$cols.'">'
-        . htmlentities($data["content"]) . "</textarea>"
+        . htmlentities($data["content"],ENT_COMPAT,get_string('thischarset','moodle')) . "</textarea>"
         . $GLOBALS["ewiki_t"]["C"]["EDIT_TEXTAREA_RESIZE_JS"];
 
    ##### BEGIN MOODLE ADDITION #####
@@ -1855,7 +1856,7 @@
             }
             #-- html comment
             #if (!strncmp($line, "&lt;!--", 7)) {
-            #   $out .= "<!-- " . htmlentities(str_replace("--", "__", substr($line, 7))) . " -->\n";
+            #   $out .= "<!-- " . htmlentities(str_replace("--", "__", substr($line, 7)),ENT_COMPAT,get_string('thischarset','moodle')) . " -->\n";
             #   continue;
             #}
 
@@ -2324,17 +2325,17 @@
    elseif (@$states["define"]) {
       $type = array("anchor");
       if ($title==$href) { $title="&nbsp;"; }
-      $str = '<a name="' . htmlentities(ltrim($href, "#")) . '">' . ltrim($title, "#") . '</a>';
+      $str = '<a name="' . htmlentities(ltrim($href, "#"),ENT_COMPAT,get_string('thischarset','moodle')) . '">' . ltrim($title, "#") . '</a>';
    }
    #-- inner page anchor jumps
    elseif (strlen($href2) && ($href==$ewiki_id) || ($href[0]=="#") && ($href2=&$href)) {
       $type = array("jump");
-      $str = '<a href="' . htmlentities($href2) . '">' . $title . '</a>';
+      $str = '<a href="' . htmlentities($href2,ENT_COMPAT,get_string('thischarset','moodle')) . '">' . $title . '</a>';
    }
    #-- ordinary internal WikiLinks
    elseif (($ewiki_links === true) || @$ewiki_links[$href_i]) {
       $type = array("wikipage");
-      $str = '<a href="' . ewiki_script("", $href) . htmlentities($href2)
+      $str = '<a href="' . ewiki_script("", $href) . htmlentities($href2,ENT_COMPAT,get_string('thischarset','moodle'))
            . '">' . $title . '</a>';
    }
    #-- guess for mail@addresses, convert to URI if
@@ -2417,7 +2418,7 @@
                 (@$states["titled"] ? ' title="' . ($title) . '"' : '').
 		($x && $y ? " width=\"$x\" height=\"$y\"" : "") .
                 $align . " />" . ($obj ? "</embed>" : "");
-                                            # htmlentities($title)
+                                            # htmlentities($title,ENT_COMPAT,get_string('thischarset','moodle'))
       }
 
       break;
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/wiki/ewiki/plugins/email_protect.php /home/httpd/html/moodle/mod/wiki/ewiki/plugins/email_protect.php
--- /home/httpd/html/moodle.orig/mod/wiki/ewiki/plugins/email_protect.php	2005-05-24 15:07:45.000000000 +0900
+++ /home/httpd/html/moodle/mod/wiki/ewiki/plugins/email_protect.php	2005-09-25 00:13:55.000000000 +0900
@@ -125,7 +125,7 @@
              $html .= '<input type="hidden" name="'.EWIKI_UP_ENCEMAIL.'" value="' . $email . '" />';
              foreach (array_merge($_GET, $_POST) as $var=>$value) {
                 if (($var != "id") && ($var != EWIKI_UP_ENCEMAIL) && ($var != EWIKI_UP_NOSPAMBOT)) {
-                   $html .= '<input type="hidden" name="' . htmlentities($var) . '" value="' . htmlentities($value) . '" />';
+                   $html .= '<input type="hidden" name="' . htmlentities($var,ENT_COMPAT,get_string('thischarset','moodle')) . '" value="' . htmlentities($value,ENT_COMPAT,get_string('thischarset','moodle')) . '" />';
                 }
              }
              $html .= '<input type="checkbox" name="'.EWIKI_UP_NOSPAMBOT.'" value="true" /> ' . ewiki_t("PROTE4") . '<br /><br />';
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/wiki/ewiki/plugins/moodle/diff.php /home/httpd/html/moodle/mod/wiki/ewiki/plugins/moodle/diff.php
--- /home/httpd/html/moodle.orig/mod/wiki/ewiki/plugins/moodle/diff.php	2005-05-24 15:07:45.000000000 +0900
+++ /home/httpd/html/moodle/mod/wiki/ewiki/plugins/moodle/diff.php	2005-09-25 00:13:55.000000000 +0900
@@ -76,7 +76,7 @@
 
     foreach ($txt2 as $i => $line) {
 //       if($wiki->htmlmode != 2) {
-//         $line = htmlentities($line);
+//         $line = htmlentities($line,ENT_COMPAT,get_string('thischarset','moodle'));
 //       }
        $i2 = $i;
        while ($rm = $diff0[$i2++]) {          
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/wiki/lib.php /home/httpd/html/moodle/mod/wiki/lib.php
--- /home/httpd/html/moodle.orig/mod/wiki/lib.php	2005-07-06 11:19:10.000000000 +0900
+++ /home/httpd/html/moodle/mod/wiki/lib.php	2005-10-14 08:09:25.000000000 +0900
@@ -1050,7 +1050,7 @@
   $ewscript = 'admin.php?id='.$cmid;
   if (isset($userid) && $userid!=0) $ewscript .= '&amp;userid='.$userid;
   if (isset($groupid) && $groupid!=0) $ewscript .= '&amp;groupid='.$groupid;
-  if (isset($page)) $ewscript .= '&amp;page='.$page;
+  if (isset($page)) $ewscript .= '&amp;page='.urlencode($page);
   $ewscript.="&amp;action=";
 
 
@@ -1106,11 +1106,11 @@
     $cell_pagename="";
     $cell_flags="";
     if ($data["flags"] & EWIKI_DB_F_TEXT) {
-        $cell_pagename .= '<A HREF="' . EWIKI_SCRIPT . $id . '">';
+        $cell_pagename .= '<A HREF="' . EWIKI_SCRIPT . urlencode($id) . '">';
     } else {
         $cell_pagename .= '<A HREF="' . EWIKI_SCRIPT_BINARY . $id . '">';
     }
-    $cell_pagename .= htmlentities($id) . '</A> / '.get_string("version","wiki").": ".$row["version"];
+    $cell_pagename .= htmlentities($id,ENT_COMPAT,get_string('thischarset','moodle')) . '</A> / '.get_string("version","wiki").": ".$row["version"];
 
     foreach ($FD as $n=>$str) {
         $cell_flags .='<INPUT TYPE="checkbox" NAME="flags['. rawurlencode($id)
@@ -1249,7 +1249,7 @@
     } else {
         $table_page='<A HREF="' . ewiki_script_binary("", $id) . '">';
     }
-    $table_page .= htmlentities($id) . '</A>';
+    $table_page .= htmlentities($id,ENT_COMPAT,get_string('thischarset','moodle')) . '</A>';
 
     #-- print reason
     $table_reason=$reason;
@@ -1304,7 +1304,7 @@
           $versiondefault=$version[$i];
         }
         $table->data[]=array('<input type="checkbox" value="'.rawurlencode($id).'" name="pagestostrip['.$i.']" '.$checked.' />',
-                        '<A HREF="'.EWIKI_SCRIPT.$id.'">'.htmlentities($id).'</A> / '.get_string("version","wiki").": ".$row["version"],
+                        '<A HREF="'.EWIKI_SCRIPT.$id.'">'.htmlentities($id,ENT_COMPAT,get_string('thischarset','moodle')).'</A> / '.get_string("version","wiki").": ".$row["version"],
                         '<input name="version['.$i.']" value="'.$versiondefault.'" size="7" />'.$error);
 
       }
@@ -1357,7 +1357,7 @@
   $result = ewiki_database("GETALL",array());
   while ($row = $result->get()) {
     if(!($row["flags"] & EWIKI_DB_F_BINARY)) {
-      $index=htmlentities($row["id"]);
+      $index=htmlentities($row["id"],ENT_COMPAT,get_string('thischarset','moodle'));
       $ret[$index] = $row["id"];
     }
   }
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/wiki/restorelib.php /home/httpd/html/moodle/mod/wiki/restorelib.php
--- /home/httpd/html/moodle.orig/mod/wiki/restorelib.php	2005-07-13 11:18:00.000000000 +0900
+++ /home/httpd/html/moodle/mod/wiki/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -350,7 +350,7 @@
                     $page->content = addslashes($result);
                     $status = update_record("wiki_pages",$page);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
@@ -380,7 +380,7 @@
                     $wiki->summary = addslashes($result);
                     $status = update_record("wiki",$wiki);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/wiki/view.php /home/httpd/html/moodle/mod/wiki/view.php
--- /home/httpd/html/moodle.orig/mod/wiki/view.php	2005-05-24 15:07:45.000000000 +0900
+++ /home/httpd/html/moodle/mod/wiki/view.php	2005-10-13 23:39:43.000000000 +0900
@@ -333,7 +333,9 @@
         $currenttab = '';
         foreach ($tabs as $tab) {
             $tabname = get_string("tab$tab", 'wiki');
-            $row[] = new tabobject($tabname, $ewbase.'&amp;page='.$tab.'/'.$ewiki_id, $tabname);
+//          $row[] = new tabobject($tabname, $ewbase.'&amp;page='.$tab.'/'.$ewiki_id, $tabname);
+            // t-kita 20051013
+            $row[] = new tabobject($tabname, $ewbase.'&amp;page='.$tab.'/'.urlencode($ewiki_id), $tabname);
             if ($ewiki_action == "$tab" or in_array($page, $specialpages)) {
                 $currenttab = $tabname;
             }
diff -Naru -x '*~' /home/httpd/html/moodle.orig/mod/workshop/restorelib.php /home/httpd/html/moodle/mod/workshop/restorelib.php
--- /home/httpd/html/moodle.orig/mod/workshop/restorelib.php	2005-07-13 11:18:01.000000000 +0900
+++ /home/httpd/html/moodle/mod/workshop/restorelib.php	2005-09-25 00:13:55.000000000 +0900
@@ -733,7 +733,7 @@
                     $workshop->description = addslashes($result);
                     $status = update_record("workshop",$workshop);
                     if ($CFG->debug>7) {
-                        echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
+                        echo '<br /><hr />'.htmlentities($content,ENT_COMPAT,get_string('thischarset','moodle')).'<br />changed to<br />'.htmlentities($result,ENT_COMPAT,get_string('thischarset','moodle')).'<hr /><br />';
                     }
                 }
                 //Do some output
diff -Naru -x '*~' /home/httpd/html/moodle.orig/user/edit.html /home/httpd/html/moodle/user/edit.html
--- /home/httpd/html/moodle.orig/user/edit.html	2005-07-06 11:19:30.000000000 +0900
+++ /home/httpd/html/moodle/user/edit.html	2005-11-14 00:31:14.000000000 +0900
@@ -85,20 +85,44 @@
 }
 
 ?>
-<tr>
+
+
+<?php 
+$nameordercheck->firstname = "a";
+$nameordercheck->lastname  = "b";
+if ( fullname($nameordercheck) == "b a" ){ ?>
+  <tr>
+    <th><?php print_string("lastname") ?>:</th>
+    <td>
+    <input type="text" name="lastname" size="30" alt="<?php print_string("lastname") ?>" maxlength="20" value="<?php p($user->lastname) ?>" />
+    <?php if (isset($err["lastname"])) formerr($err["lastname"]); ?>
+    </td>
+  </tr>
+  <tr>
     <th><?php print_string("firstname") ?>:</th>
     <td>
     <input type="text" name="firstname" size="30" alt="<?php print_string("firstname") ?>" maxlength="20" value="<?php p($user->firstname) ?>" />
     <?php if (isset($err["firstname"])) formerr($err["firstname"]); ?>
     </td>
-</tr>
-<tr>
+  </tr>
+<?php }else{ ?>
+  <tr>
+    <th><?php print_string("firstname") ?>:</th>
+    <td>
+    <input type="text" name="firstname" size="30" alt="<?php print_string("firstname") ?>" maxlength="20" value="<?php p($user->firstname) ?>" />
+    <?php if (isset($err["firstname"])) formerr($err["firstname"]); ?>
+    </td>
+  </tr>
+  <tr>
     <th><?php print_string("lastname") ?>:</th>
     <td>
     <input type="text" name="lastname" size="30" alt="<?php print_string("lastname") ?>" maxlength="20" value="<?php p($user->lastname) ?>" />
     <?php if (isset($err["lastname"])) formerr($err["lastname"]); ?>
     </td>
-</tr>
+  </tr>
+<?php } ?>
+
+
 <tr>
     <th><?php print_string("email") ?>:</th>
     <td>
