===== sql/log.cc 1.281 vs edited =====
--- 1.281/sql/log.cc	2007-05-18 06:21:26 +10:00
+++ edited/sql/log.cc	2007-07-05 14:52:14 +10:00
@@ -1567,7 +1567,9 @@
   }
   if (all)
   {
-    Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
+    String b((char*)NULL, 0, thd->variables.character_set_client);
+    b.append("COMMIT");
+    Query_log_event qev(thd, b.c_ptr(), b.length(), TRUE, FALSE);
     qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
     int error= binlog_end_trans(thd, trx_data, &qev, all);
     DBUG_RETURN(error);
@@ -3990,7 +3992,15 @@
       */
       if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
       {
-        Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE);
+        /*
+          We use String object to convert from ASCII "BEGIN" to
+          "BEGIN" in the current charset.
+          Otherwise we end up in a bad place (e.g. default charset=ucs2)
+        */
+        String b((char*)NULL, 0, thd->variables.character_set_client);
+        b.append("BEGIN");
+        Query_log_event qinfo(thd, b.c_ptr(), b.length(), TRUE, FALSE);
+
         /*
           Imagine this is rollback due to net timeout, after all statements of
           the transaction succeeded. Then we want a zero-error code in BEGIN.