summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/jp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/jp
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/jp')
-rw-r--r--mysql-test/suite/jp/disabled.def13
-rw-r--r--mysql-test/suite/jp/include/trim_sjis.inc70
-rw-r--r--mysql-test/suite/jp/r/jp_alter_sjis.result494
-rw-r--r--mysql-test/suite/jp/r/jp_alter_ucs2.result495
-rw-r--r--mysql-test/suite/jp/r/jp_alter_ujis.result494
-rw-r--r--mysql-test/suite/jp/r/jp_alter_utf8.result494
-rw-r--r--mysql-test/suite/jp/r/jp_charlength_sjis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_charlength_ucs2.result111
-rw-r--r--mysql-test/suite/jp/r/jp_charlength_ujis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_charlength_utf8.result110
-rw-r--r--mysql-test/suite/jp/r/jp_charset_sjis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_charset_ucs2.result230
-rw-r--r--mysql-test/suite/jp/r/jp_charset_ujis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_charset_utf8.result173
-rw-r--r--mysql-test/suite/jp/r/jp_convert_sjis.result785
-rw-r--r--mysql-test/suite/jp/r/jp_convert_ucs2.result345
-rw-r--r--mysql-test/suite/jp/r/jp_convert_ujis.result1232
-rw-r--r--mysql-test/suite/jp/r/jp_convert_utf8.result1250
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_sjis.result24
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_ucs2.result25
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_ujis.result24
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_utf8.result24
-rw-r--r--mysql-test/suite/jp/r/jp_create_tbl_sjis.result521
-rw-r--r--mysql-test/suite/jp/r/jp_create_tbl_ucs2.result521
-rw-r--r--mysql-test/suite/jp/r/jp_create_tbl_ujis.result521
-rw-r--r--mysql-test/suite/jp/r/jp_create_tbl_utf8.result521
-rw-r--r--mysql-test/suite/jp/r/jp_enum_sjis.result279
-rw-r--r--mysql-test/suite/jp/r/jp_enum_ucs2.result273
-rw-r--r--mysql-test/suite/jp/r/jp_enum_ujis.result272
-rw-r--r--mysql-test/suite/jp/r/jp_enum_utf8.result272
-rw-r--r--mysql-test/suite/jp/r/jp_insert_sjis.result713
-rw-r--r--mysql-test/suite/jp/r/jp_insert_ucs2.result714
-rw-r--r--mysql-test/suite/jp/r/jp_insert_ujis.result714
-rw-r--r--mysql-test/suite/jp/r/jp_insert_utf8.result713
-rw-r--r--mysql-test/suite/jp/r/jp_instr_sjis.result200
-rw-r--r--mysql-test/suite/jp/r/jp_instr_ucs2.result201
-rw-r--r--mysql-test/suite/jp/r/jp_instr_ujis.result200
-rw-r--r--mysql-test/suite/jp/r/jp_instr_utf8.result200
-rw-r--r--mysql-test/suite/jp/r/jp_join_sjis.result443
-rw-r--r--mysql-test/suite/jp/r/jp_join_ucs2.result444
-rw-r--r--mysql-test/suite/jp/r/jp_join_ujis.result443
-rw-r--r--mysql-test/suite/jp/r/jp_join_utf8.result443
-rw-r--r--mysql-test/suite/jp/r/jp_left_sjis.result470
-rw-r--r--mysql-test/suite/jp/r/jp_left_ucs2.result471
-rw-r--r--mysql-test/suite/jp/r/jp_left_ujis.result470
-rw-r--r--mysql-test/suite/jp/r/jp_left_utf8.result470
-rw-r--r--mysql-test/suite/jp/r/jp_length_sjis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_length_ucs2.result111
-rw-r--r--mysql-test/suite/jp/r/jp_length_ujis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_length_utf8.result110
-rw-r--r--mysql-test/suite/jp/r/jp_like_sjis.result260
-rw-r--r--mysql-test/suite/jp/r/jp_like_ucs2.result315
-rw-r--r--mysql-test/suite/jp/r/jp_like_ujis.result260
-rw-r--r--mysql-test/suite/jp/r/jp_like_utf8.result260
-rw-r--r--mysql-test/suite/jp/r/jp_locate_sjis.result200
-rw-r--r--mysql-test/suite/jp/r/jp_locate_ucs2.result201
-rw-r--r--mysql-test/suite/jp/r/jp_locate_ujis.result200
-rw-r--r--mysql-test/suite/jp/r/jp_locate_utf8.result200
-rw-r--r--mysql-test/suite/jp/r/jp_lpad_sjis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_lpad_ucs2.result111
-rw-r--r--mysql-test/suite/jp/r/jp_lpad_ujis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_lpad_utf8.result110
-rw-r--r--mysql-test/suite/jp/r/jp_ltrim_sjis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_ltrim_ucs2.result174
-rw-r--r--mysql-test/suite/jp/r/jp_ltrim_ujis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_ltrim_utf8.result173
-rw-r--r--mysql-test/suite/jp/r/jp_ps_sjis.result669
-rw-r--r--mysql-test/suite/jp/r/jp_ps_ujis.result669
-rw-r--r--mysql-test/suite/jp/r/jp_replace_sjis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_replace_ucs2.result174
-rw-r--r--mysql-test/suite/jp/r/jp_replace_ujis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_replace_utf8.result173
-rw-r--r--mysql-test/suite/jp/r/jp_reverse_sjis.result65
-rw-r--r--mysql-test/suite/jp/r/jp_reverse_ucs2.result66
-rw-r--r--mysql-test/suite/jp/r/jp_reverse_ujis.result65
-rw-r--r--mysql-test/suite/jp/r/jp_reverse_utf8.result65
-rw-r--r--mysql-test/suite/jp/r/jp_right_sjis.result470
-rw-r--r--mysql-test/suite/jp/r/jp_right_ucs2.result471
-rw-r--r--mysql-test/suite/jp/r/jp_right_ujis.result470
-rw-r--r--mysql-test/suite/jp/r/jp_right_utf8.result470
-rw-r--r--mysql-test/suite/jp/r/jp_rpad_sjis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_rpad_ucs2.result111
-rw-r--r--mysql-test/suite/jp/r/jp_rpad_ujis.result110
-rw-r--r--mysql-test/suite/jp/r/jp_rpad_utf8.result110
-rw-r--r--mysql-test/suite/jp/r/jp_rtrim_sjis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_rtrim_ucs2.result174
-rw-r--r--mysql-test/suite/jp/r/jp_rtrim_ujis.result173
-rw-r--r--mysql-test/suite/jp/r/jp_rtrim_utf8.result173
-rw-r--r--mysql-test/suite/jp/r/jp_select_sjis.result287
-rw-r--r--mysql-test/suite/jp/r/jp_select_ucs2.result171
-rw-r--r--mysql-test/suite/jp/r/jp_select_ujis.result404
-rw-r--r--mysql-test/suite/jp/r/jp_select_utf8.result404
-rw-r--r--mysql-test/suite/jp/r/jp_subquery_sjis.result155
-rw-r--r--mysql-test/suite/jp/r/jp_subquery_ucs2.result165
-rw-r--r--mysql-test/suite/jp/r/jp_subquery_ujis.result164
-rw-r--r--mysql-test/suite/jp/r/jp_subquery_utf8.result155
-rw-r--r--mysql-test/suite/jp/r/jp_substring_sjis.result2054
-rw-r--r--mysql-test/suite/jp/r/jp_substring_ucs2.result1047
-rw-r--r--mysql-test/suite/jp/r/jp_substring_ujis.result2054
-rw-r--r--mysql-test/suite/jp/r/jp_substring_utf8.result2054
-rw-r--r--mysql-test/suite/jp/r/jp_trim_sjis.result510
-rw-r--r--mysql-test/suite/jp/r/jp_trim_ucs2.result507
-rw-r--r--mysql-test/suite/jp/r/jp_trim_ujis.result506
-rw-r--r--mysql-test/suite/jp/r/jp_trim_utf8.result506
-rw-r--r--mysql-test/suite/jp/r/jp_union_ujis.result324
-rw-r--r--mysql-test/suite/jp/r/jp_update_sjis.result74
-rw-r--r--mysql-test/suite/jp/r/jp_update_ucs2.result75
-rw-r--r--mysql-test/suite/jp/r/jp_update_ujis.result74
-rw-r--r--mysql-test/suite/jp/r/jp_update_utf8.result74
-rw-r--r--mysql-test/suite/jp/r/jp_where_sjis.result95
-rw-r--r--mysql-test/suite/jp/r/jp_where_ucs2.result123
-rw-r--r--mysql-test/suite/jp/r/jp_where_ujis.result65
-rw-r--r--mysql-test/suite/jp/r/jp_where_utf8.result65
-rw-r--r--mysql-test/suite/jp/std_data/jisx0201_sjis.dat10
-rw-r--r--mysql-test/suite/jp/std_data/jisx0201_ucs2.datbin0 -> 346 bytes
-rw-r--r--mysql-test/suite/jp/std_data/jisx0201_ujis.dat10
-rw-r--r--mysql-test/suite/jp/std_data/jisx0201_utf8.dat10
-rw-r--r--mysql-test/suite/jp/std_data/jisx0208_sjis.dat66
-rw-r--r--mysql-test/suite/jp/std_data/jisx0208_sjis2.dat1
-rw-r--r--mysql-test/suite/jp/std_data/jisx0208_sjis3.dat5
-rw-r--r--mysql-test/suite/jp/std_data/jisx0208_ucs2.datbin0 -> 2782 bytes
-rw-r--r--mysql-test/suite/jp/std_data/jisx0208_ujis.dat66
-rw-r--r--mysql-test/suite/jp/std_data/jisx0208_utf8.dat66
-rw-r--r--mysql-test/suite/jp/std_data/jisx0212_ucs2.datbin0 -> 1682 bytes
-rw-r--r--mysql-test/suite/jp/std_data/jisx0212_ujis.dat40
-rw-r--r--mysql-test/suite/jp/std_data/jisx0212_utf8.dat40
-rw-r--r--mysql-test/suite/jp/t/jp_alter_sjis.test318
-rw-r--r--mysql-test/suite/jp/t/jp_alter_ucs2.test320
-rw-r--r--mysql-test/suite/jp/t/jp_alter_ujis.test320
-rw-r--r--mysql-test/suite/jp/t/jp_alter_utf8.test319
-rw-r--r--mysql-test/suite/jp/t/jp_charlength_sjis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_charlength_ucs2.test67
-rw-r--r--mysql-test/suite/jp/t/jp_charlength_ujis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_charlength_utf8.test65
-rw-r--r--mysql-test/suite/jp/t/jp_charset_sjis.test109
-rw-r--r--mysql-test/suite/jp/t/jp_charset_ucs2.test174
-rw-r--r--mysql-test/suite/jp/t/jp_charset_ujis.test110
-rw-r--r--mysql-test/suite/jp/t/jp_charset_utf8.test110
-rw-r--r--mysql-test/suite/jp/t/jp_convert_sjis.test93
-rw-r--r--mysql-test/suite/jp/t/jp_convert_ucs2.test161
-rw-r--r--mysql-test/suite/jp/t/jp_convert_ujis.test95
-rw-r--r--mysql-test/suite/jp/t/jp_convert_utf8.test94
-rw-r--r--mysql-test/suite/jp/t/jp_create_db_sjis.test27
-rw-r--r--mysql-test/suite/jp/t/jp_create_db_ucs2.test29
-rw-r--r--mysql-test/suite/jp/t/jp_create_db_ujis.test28
-rw-r--r--mysql-test/suite/jp/t/jp_create_db_utf8.test27
-rw-r--r--mysql-test/suite/jp/t/jp_create_tbl_sjis.test238
-rw-r--r--mysql-test/suite/jp/t/jp_create_tbl_ucs2.test243
-rw-r--r--mysql-test/suite/jp/t/jp_create_tbl_ujis.test243
-rw-r--r--mysql-test/suite/jp/t/jp_create_tbl_utf8.test242
-rw-r--r--mysql-test/suite/jp/t/jp_enum_sjis.test130
-rw-r--r--mysql-test/suite/jp/t/jp_enum_ucs2.test123
-rw-r--r--mysql-test/suite/jp/t/jp_enum_ujis.test119
-rw-r--r--mysql-test/suite/jp/t/jp_enum_utf8.test118
-rw-r--r--mysql-test/suite/jp/t/jp_insert_sjis.test282
-rw-r--r--mysql-test/suite/jp/t/jp_insert_ucs2.test283
-rw-r--r--mysql-test/suite/jp/t/jp_insert_ujis.test283
-rw-r--r--mysql-test/suite/jp/t/jp_insert_utf8.test281
-rw-r--r--mysql-test/suite/jp/t/jp_instr_sjis.test111
-rw-r--r--mysql-test/suite/jp/t/jp_instr_ucs2.test112
-rw-r--r--mysql-test/suite/jp/t/jp_instr_ujis.test111
-rw-r--r--mysql-test/suite/jp/t/jp_instr_utf8.test110
-rw-r--r--mysql-test/suite/jp/t/jp_join_sjis.test179
-rw-r--r--mysql-test/suite/jp/t/jp_join_ucs2.test180
-rw-r--r--mysql-test/suite/jp/t/jp_join_ujis.test179
-rw-r--r--mysql-test/suite/jp/t/jp_join_utf8.test178
-rw-r--r--mysql-test/suite/jp/t/jp_left_sjis.test111
-rw-r--r--mysql-test/suite/jp/t/jp_left_ucs2.test112
-rw-r--r--mysql-test/suite/jp/t/jp_left_ujis.test111
-rw-r--r--mysql-test/suite/jp/t/jp_left_utf8.test110
-rw-r--r--mysql-test/suite/jp/t/jp_length_sjis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_length_ucs2.test67
-rw-r--r--mysql-test/suite/jp/t/jp_length_ujis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_length_utf8.test65
-rw-r--r--mysql-test/suite/jp/t/jp_like_sjis.test132
-rw-r--r--mysql-test/suite/jp/t/jp_like_ucs2.test209
-rw-r--r--mysql-test/suite/jp/t/jp_like_ujis.test134
-rw-r--r--mysql-test/suite/jp/t/jp_like_utf8.test133
-rw-r--r--mysql-test/suite/jp/t/jp_locate_sjis.test112
-rw-r--r--mysql-test/suite/jp/t/jp_locate_ucs2.test114
-rw-r--r--mysql-test/suite/jp/t/jp_locate_ujis.test113
-rw-r--r--mysql-test/suite/jp/t/jp_locate_utf8.test112
-rw-r--r--mysql-test/suite/jp/t/jp_lpad_sjis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_lpad_ucs2.test67
-rw-r--r--mysql-test/suite/jp/t/jp_lpad_ujis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_lpad_utf8.test65
-rw-r--r--mysql-test/suite/jp/t/jp_ltrim_sjis.test129
-rw-r--r--mysql-test/suite/jp/t/jp_ltrim_ucs2.test130
-rw-r--r--mysql-test/suite/jp/t/jp_ltrim_ujis.test129
-rw-r--r--mysql-test/suite/jp/t/jp_ltrim_utf8.test128
-rw-r--r--mysql-test/suite/jp/t/jp_ps_sjis.test348
-rw-r--r--mysql-test/suite/jp/t/jp_ps_ujis.test347
-rw-r--r--mysql-test/suite/jp/t/jp_replace_sjis.test102
-rw-r--r--mysql-test/suite/jp/t/jp_replace_ucs2.test103
-rw-r--r--mysql-test/suite/jp/t/jp_replace_ujis.test102
-rw-r--r--mysql-test/suite/jp/t/jp_replace_utf8.test101
-rw-r--r--mysql-test/suite/jp/t/jp_reverse_sjis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_reverse_ucs2.test67
-rw-r--r--mysql-test/suite/jp/t/jp_reverse_ujis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_reverse_utf8.test65
-rw-r--r--mysql-test/suite/jp/t/jp_right_sjis.test111
-rw-r--r--mysql-test/suite/jp/t/jp_right_ucs2.test112
-rw-r--r--mysql-test/suite/jp/t/jp_right_ujis.test111
-rw-r--r--mysql-test/suite/jp/t/jp_right_utf8.test110
-rw-r--r--mysql-test/suite/jp/t/jp_rpad_sjis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_rpad_ucs2.test67
-rw-r--r--mysql-test/suite/jp/t/jp_rpad_ujis.test66
-rw-r--r--mysql-test/suite/jp/t/jp_rpad_utf8.test66
-rw-r--r--mysql-test/suite/jp/t/jp_rtrim_sjis.test129
-rw-r--r--mysql-test/suite/jp/t/jp_rtrim_ucs2.test130
-rw-r--r--mysql-test/suite/jp/t/jp_rtrim_ujis.test129
-rw-r--r--mysql-test/suite/jp/t/jp_rtrim_utf8.test128
-rw-r--r--mysql-test/suite/jp/t/jp_select_sjis.test69
-rw-r--r--mysql-test/suite/jp/t/jp_select_ucs2.test135
-rw-r--r--mysql-test/suite/jp/t/jp_select_ujis.test69
-rw-r--r--mysql-test/suite/jp/t/jp_select_utf8.test68
-rw-r--r--mysql-test/suite/jp/t/jp_subquery_sjis.test112
-rw-r--r--mysql-test/suite/jp/t/jp_subquery_ucs2.test122
-rw-r--r--mysql-test/suite/jp/t/jp_subquery_ujis.test121
-rw-r--r--mysql-test/suite/jp/t/jp_subquery_utf8.test114
-rw-r--r--mysql-test/suite/jp/t/jp_substring_sjis.test316
-rw-r--r--mysql-test/suite/jp/t/jp_substring_ucs2.test319
-rw-r--r--mysql-test/suite/jp/t/jp_substring_ujis.test315
-rw-r--r--mysql-test/suite/jp/t/jp_substring_utf8.test314
-rw-r--r--mysql-test/suite/jp/t/jp_trim_sjis.test13
-rw-r--r--mysql-test/suite/jp/t/jp_trim_ucs2.test173
-rw-r--r--mysql-test/suite/jp/t/jp_trim_ujis.test172
-rw-r--r--mysql-test/suite/jp/t/jp_trim_utf8.test171
-rw-r--r--mysql-test/suite/jp/t/jp_union_ujis.test103
-rw-r--r--mysql-test/suite/jp/t/jp_update_sjis.test76
-rw-r--r--mysql-test/suite/jp/t/jp_update_ucs2.test77
-rw-r--r--mysql-test/suite/jp/t/jp_update_ujis.test76
-rw-r--r--mysql-test/suite/jp/t/jp_update_utf8.test75
-rw-r--r--mysql-test/suite/jp/t/jp_where_sjis.test93
-rw-r--r--mysql-test/suite/jp/t/jp_where_ucs2.test137
-rw-r--r--mysql-test/suite/jp/t/jp_where_ujis.test71
-rw-r--r--mysql-test/suite/jp/t/jp_where_utf8.test70
237 files changed, 53515 insertions, 0 deletions
diff --git a/mysql-test/suite/jp/disabled.def b/mysql-test/suite/jp/disabled.def
new file mode 100644
index 00000000..b7438289
--- /dev/null
+++ b/mysql-test/suite/jp/disabled.def
@@ -0,0 +1,13 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+binlog_index : codership/mysql-wsrep##71 Regression: Duplicate "file was not purged because it is the active log file" warning
diff --git a/mysql-test/suite/jp/include/trim_sjis.inc b/mysql-test/suite/jp/include/trim_sjis.inc
new file mode 100644
index 00000000..fee31a51
--- /dev/null
+++ b/mysql-test/suite/jp/include/trim_sjis.inc
@@ -0,0 +1,70 @@
+#
+# Test TRIM() function with Japanese characters sjis encoding
+#
+
+--source include/have_sjis.inc
+--character_set sjis
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+--disable_warnings
+DROP TABLE IF EXISTS `sP`;
+DROP TABLE IF EXISTS `sQ`;
+DROP TABLE IF EXISTS `sR`;
+--enable_warnings
+--replace_result $engine <engine_to_be_tested>
+eval CREATE TABLE `sP` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = $engine;
+--replace_result $engine <engine_to_be_tested>
+eval CREATE TABLE `sQ` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = $engine;
+--replace_result $engine <engine_to_be_tested>
+eval CREATE TABLE `sR` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = $engine;
+
+# Nothing to trim
+INSERT INTO `sP` VALUES ('');
+# Test data for TRIM(TRAILING [remstr] FROM str)
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+# Test data for TRIM(LEADING [remstr] FROM str)
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+# Test data for TRIM(BOTH [remstr] FROM str)
+INSERT INTO `sP` VALUES ('');
+# Test data for TRIM without [remstr] (remove spaces)
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\\\\');
+INSERT INTO `sR` VALUES (' \\\\\ ');
+
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sP`;
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sP`;
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sP`;
+SELECT `bP`,TRIM(`bP`) FROM `sP`;
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sQ`;
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sQ`;
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sQ`;
+SELECT `bP`,TRIM(`bP`) FROM `sQ`;
+SELECT `bP`,TRIM(TRAILING '\' FROM `bP`) FROM `sR`;
+SELECT `bP`,TRIM(LEADING '\' FROM `bP`) FROM `sR`;
+SELECT `bP`,TRIM(BOTH '\' FROM `bP`) FROM `sR`;
+SELECT `bP`,TRIM(`bP`) FROM `sR`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
diff --git a/mysql-test/suite/jp/r/jp_alter_sjis.result b/mysql-test/suite/jp/r/jp_alter_sjis.result
new file mode 100644
index 00000000..5574f543
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_alter_sjis.result
@@ -0,0 +1,494 @@
+SET NAMES sjis;
+SET character_set_database = sjis;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `\\\` VALUES ('\\\\\'),('\\\\\'),('\\\\\');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `\\\` ADD `\\\` char(1) FIRST;
+ALTER TABLE `\\\` ADD `\\\` char(1) AFTER `\\\`;
+ALTER TABLE `\\\` ADD `\\\` char(1);
+ALTER TABLE `\\\` ADD INDEX (`\\\`);
+ALTER TABLE `\\\` ADD PRIMARY KEY (`\\\`);
+ALTER TABLE `\\\` ADD UNIQUE (`\\\`);
+ALTER TABLE `\\\` CHANGE `\\\` `\\` char(1);
+ALTER TABLE `\\\` MODIFY `\\\` char(6);
+SELECT * FROM `\\\`;
+\\ \\\ \\\ \\\
+NULL \\\\\ NULL NULL
+NULL \\\\\ NULL NULL
+NULL \\\\\ NULL NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\ char(1) YES MUL NULL
+\\\ char(6) NO PRI NULL
+\\\ char(1) YES UNI NULL
+\\\ char(1) YES NULL
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\` char(1) DEFAULT NULL,
+ `\\\` char(6) NOT NULL,
+ `\\\` char(1) DEFAULT NULL,
+ `\\\` char(1) DEFAULT NULL,
+ PRIMARY KEY (`\\\`),
+ UNIQUE KEY `\\\` (`\\\`),
+ KEY `\\\` (`\\`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP PRIMARY KEY;
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP `\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+SELECT * FROM `\\\`;
+\\\
+\\\\\
+\\\\\
+\\\\\
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(6) NO NULL
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `\\\` VALUES ('\\\\\'),('\\\\\'),('\\\\\');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `\\\` ADD `\\\` char(1) FIRST;
+ALTER TABLE `\\\` ADD `\\\` char(1) AFTER `\\\`;
+ALTER TABLE `\\\` ADD `\\\` char(1);
+ALTER TABLE `\\\` ADD INDEX (`\\\`);
+ALTER TABLE `\\\` ADD PRIMARY KEY (`\\\`);
+ALTER TABLE `\\\` ADD UNIQUE (`\\\`);
+ALTER TABLE `\\\` CHANGE `\\\` `\\` char(1);
+ALTER TABLE `\\\` MODIFY `\\\` char(6);
+SELECT * FROM `\\\`;
+\\ \\\ \\\ \\\
+NULL \\\\\ NULL NULL
+NULL \\\\\ NULL NULL
+NULL \\\\\ NULL NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\ char(1) YES MUL NULL
+\\\ char(6) NO PRI NULL
+\\\ char(1) YES UNI NULL
+\\\ char(1) YES NULL
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\` char(1) DEFAULT NULL,
+ `\\\` char(6) NOT NULL,
+ `\\\` char(1) DEFAULT NULL,
+ `\\\` char(1) DEFAULT NULL,
+ PRIMARY KEY (`\\\`),
+ UNIQUE KEY `\\\` (`\\\`),
+ KEY `\\\` (`\\`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP PRIMARY KEY;
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP `\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+SELECT * FROM `\\\`;
+\\\
+\\\\\
+\\\\\
+\\\\\
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(6) NO NULL
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `\\\` VALUES ('\\\\\'),('\\\\\'),('\\\\\');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `\\\` ADD `\\\` char(1) FIRST;
+ALTER TABLE `\\\` ADD `\\\` char(1) AFTER `\\\`;
+ALTER TABLE `\\\` ADD `\\\` char(1);
+ALTER TABLE `\\\` ADD INDEX (`\\\`);
+ALTER TABLE `\\\` ADD PRIMARY KEY (`\\\`);
+ALTER TABLE `\\\` ADD UNIQUE (`\\\`);
+ALTER TABLE `\\\` CHANGE `\\\` `\\` char(1);
+ALTER TABLE `\\\` MODIFY `\\\` char(6);
+SELECT * FROM `\\\`;
+\\ \\\ \\\ \\\
+NULL \\\\\ NULL NULL
+NULL \\\\\ NULL NULL
+NULL \\\\\ NULL NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\ char(1) YES MUL NULL
+\\\ char(6) NO PRI NULL
+\\\ char(1) YES UNI NULL
+\\\ char(1) YES NULL
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\` char(1) DEFAULT NULL,
+ `\\\` char(6) NOT NULL,
+ `\\\` char(1) DEFAULT NULL,
+ `\\\` char(1) DEFAULT NULL,
+ PRIMARY KEY (`\\\`),
+ UNIQUE KEY `\\\` (`\\\`),
+ KEY `\\\` (`\\`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP PRIMARY KEY;
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP `\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+SELECT * FROM `\\\`;
+\\\
+\\\\\
+\\\\\
+\\\\\
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(6) NO NULL
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
diff --git a/mysql-test/suite/jp/r/jp_alter_ucs2.result b/mysql-test/suite/jp/r/jp_alter_ucs2.result
new file mode 100644
index 00000000..336bd6fe
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_alter_ucs2.result
@@ -0,0 +1,495 @@
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+SELECT * FROM `ݏݏ`;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+SELECT * FROM `ݏݏ`;
+
+
+
+
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+SELECT * FROM `ݏݏ`;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+SELECT * FROM `ݏݏ`;
+
+
+
+
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+SELECT * FROM `ݏݏ`;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+SELECT * FROM `ݏݏ`;
+
+
+
+
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
diff --git a/mysql-test/suite/jp/r/jp_alter_ujis.result b/mysql-test/suite/jp/r/jp_alter_ujis.result
new file mode 100644
index 00000000..a59c1e5a
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_alter_ujis.result
@@ -0,0 +1,494 @@
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+SELECT * FROM `ݏݏ`;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+SELECT * FROM `ݏݏ`;
+
+
+
+
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+SELECT * FROM `ݏݏ`;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+SELECT * FROM `ݏݏ`;
+
+
+
+
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+SELECT * FROM ``;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+
+
+
+
+DESC ``;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+SELECT * FROM `ݏݏ`;
+
+NULL NULL NULL
+NULL NULL NULL
+NULL NULL NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES MUL NULL
+ char(6) NO PRI NULL
+ char(1) YES UNI NULL
+ char(1) YES NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL,
+ `` char(6) NOT NULL,
+ `` char(1) DEFAULT NULL,
+ `` char(1) DEFAULT NULL,
+ PRIMARY KEY (``),
+ UNIQUE KEY `` (``),
+ KEY `` (``)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+SELECT * FROM `ݏݏ`;
+
+
+
+
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(6) NO NULL
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
diff --git a/mysql-test/suite/jp/r/jp_alter_utf8.result b/mysql-test/suite/jp/r/jp_alter_utf8.result
new file mode 100644
index 00000000..545b1274
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_alter_utf8.result
@@ -0,0 +1,494 @@
+DROP TABLE IF EXISTS `アアア`;
+DROP TABLE IF EXISTS `イイイ`;
+DROP TABLE IF EXISTS `あああ`;
+DROP TABLE IF EXISTS `いいい`;
+DROP TABLE IF EXISTS `龖龖龖`;
+DROP TABLE IF EXISTS `龗龗龗`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `アアア`(`キキキ` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `イイイ`(`ケケケ` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `あああ`(`ききき` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `いいい`(`けけけ` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龗龗龗`(`乚乚乚` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+INSERT INTO `アアア` VALUES ('アアアアア'),('イイイイイ'),('ウウウウウ');
+INSERT INTO `あああ` VALUES ('あああああ'),('いいいいい'),('ううううう');
+INSERT INTO `龖龖龖` VALUES ('丂丂丂丂丂'),('丄丄丄丄丄'),('丅丅丅丅丅');
+ALTER TABLE `アアア` ADD `カカカ` char(1) FIRST;
+ALTER TABLE `アアア` ADD `ククク` char(1) AFTER `キキキ`;
+ALTER TABLE `アアア` ADD `ケケケ` char(1);
+ALTER TABLE `アアア` ADD INDEX (`カカカ`);
+ALTER TABLE `アアア` ADD PRIMARY KEY (`キキキ`);
+ALTER TABLE `アアア` ADD UNIQUE (`ククク`);
+ALTER TABLE `アアア` CHANGE `カカカ` `カカ` char(1);
+ALTER TABLE `アアア` MODIFY `キキキ` char(6);
+SELECT * FROM `アアア`;
+カカ キキキ ククク ケケケ
+NULL アアアアア NULL NULL
+NULL イイイイイ NULL NULL
+NULL ウウウウウ NULL NULL
+DESC `アアア`;
+Field Type Null Key Default Extra
+カカ char(1) YES MUL NULL
+キキキ char(6) NO PRI NULL
+ククク char(1) YES UNI NULL
+ケケケ char(1) YES NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `カカ` char(1) DEFAULT NULL,
+ `キキキ` char(6) NOT NULL,
+ `ククク` char(1) DEFAULT NULL,
+ `ケケケ` char(1) DEFAULT NULL,
+ PRIMARY KEY (`キキキ`),
+ UNIQUE KEY `ククク` (`ククク`),
+ KEY `カカカ` (`カカ`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `アアア` DROP INDEX `カカカ`;
+ALTER TABLE `アアア` DROP PRIMARY KEY;
+ALTER TABLE `アアア` DROP INDEX `ククク`;
+ALTER TABLE `アアア` DROP `カカ`;
+ALTER TABLE `アアア` DROP `ククク`;
+ALTER TABLE `アアア` DROP `ケケケ`;
+SELECT * FROM `アアア`;
+キキキ
+アアアアア
+イイイイイ
+ウウウウウ
+DESC `アアア`;
+Field Type Null Key Default Extra
+キキキ char(6) NO NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `キキキ` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `あああ` ADD `かかか` char(1) FIRST;
+ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`;
+ALTER TABLE `あああ` ADD `けけけ` char(1);
+ALTER TABLE `あああ` ADD INDEX (`かかか`);
+ALTER TABLE `あああ` ADD PRIMARY KEY (`ききき`);
+ALTER TABLE `あああ` ADD UNIQUE (`くくく`);
+ALTER TABLE `あああ` CHANGE `かかか` `かか` char(1);
+ALTER TABLE `あああ` MODIFY `ききき` char(6);
+SELECT * FROM `あああ`;
+かか ききき くくく けけけ
+NULL あああああ NULL NULL
+NULL いいいいい NULL NULL
+NULL ううううう NULL NULL
+DESC `あああ`;
+Field Type Null Key Default Extra
+かか char(1) YES MUL NULL
+ききき char(6) NO PRI NULL
+くくく char(1) YES UNI NULL
+けけけ char(1) YES NULL
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `かか` char(1) DEFAULT NULL,
+ `ききき` char(6) NOT NULL,
+ `くくく` char(1) DEFAULT NULL,
+ `けけけ` char(1) DEFAULT NULL,
+ PRIMARY KEY (`ききき`),
+ UNIQUE KEY `くくく` (`くくく`),
+ KEY `かかか` (`かか`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `あああ` DROP INDEX `かかか`;
+ALTER TABLE `あああ` DROP PRIMARY KEY;
+ALTER TABLE `あああ` DROP INDEX `くくく`;
+ALTER TABLE `あああ` DROP `かか`;
+ALTER TABLE `あああ` DROP `くくく`;
+ALTER TABLE `あああ` DROP `けけけ`;
+SELECT * FROM `あああ`;
+ききき
+あああああ
+いいいいい
+ううううう
+DESC `あああ`;
+Field Type Null Key Default Extra
+ききき char(6) NO NULL
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `ききき` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
+ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
+ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1);
+ALTER TABLE `龖龖龖` ADD INDEX (`丄丄丄`);
+ALTER TABLE `龖龖龖` ADD PRIMARY KEY (`丂丂丂`);
+ALTER TABLE `龖龖龖` ADD UNIQUE (`丅丅丅`);
+ALTER TABLE `龖龖龖` CHANGE `丄丄丄` `丄丄` char(1);
+ALTER TABLE `龖龖龖` MODIFY `丂丂丂` char(6);
+SELECT * FROM `龖龖龖`;
+丄丄 丂丂丂 丅丅丅 乚乚乚
+NULL 丂丂丂丂丂 NULL NULL
+NULL 丄丄丄丄丄 NULL NULL
+NULL 丅丅丅丅丅 NULL NULL
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丄丄 char(1) YES MUL NULL
+丂丂丂 char(6) NO PRI NULL
+丅丅丅 char(1) YES UNI NULL
+乚乚乚 char(1) YES NULL
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丄丄` char(1) DEFAULT NULL,
+ `丂丂丂` char(6) NOT NULL,
+ `丅丅丅` char(1) DEFAULT NULL,
+ `乚乚乚` char(1) DEFAULT NULL,
+ PRIMARY KEY (`丂丂丂`),
+ UNIQUE KEY `丅丅丅` (`丅丅丅`),
+ KEY `丄丄丄` (`丄丄`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`;
+ALTER TABLE `龖龖龖` DROP PRIMARY KEY;
+ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `丄丄`;
+ALTER TABLE `龖龖龖` DROP `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `乚乚乚`;
+SELECT * FROM `龖龖龖`;
+丂丂丂
+丂丂丂丂丂
+丄丄丄丄丄
+丅丅丅丅丅
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丂丂丂 char(6) NO NULL
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丂丂丂` char(6) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+CREATE TABLE `アアア`(`キキキ` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `イイイ`(`ケケケ` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `あああ`(`ききき` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `いいい`(`けけけ` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `龗龗龗`(`乚乚乚` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+INSERT INTO `アアア` VALUES ('アアアアア'),('イイイイイ'),('ウウウウウ');
+INSERT INTO `あああ` VALUES ('あああああ'),('いいいいい'),('ううううう');
+INSERT INTO `龖龖龖` VALUES ('丂丂丂丂丂'),('丄丄丄丄丄'),('丅丅丅丅丅');
+ALTER TABLE `アアア` ADD `カカカ` char(1) FIRST;
+ALTER TABLE `アアア` ADD `ククク` char(1) AFTER `キキキ`;
+ALTER TABLE `アアア` ADD `ケケケ` char(1);
+ALTER TABLE `アアア` ADD INDEX (`カカカ`);
+ALTER TABLE `アアア` ADD PRIMARY KEY (`キキキ`);
+ALTER TABLE `アアア` ADD UNIQUE (`ククク`);
+ALTER TABLE `アアア` CHANGE `カカカ` `カカ` char(1);
+ALTER TABLE `アアア` MODIFY `キキキ` char(6);
+SELECT * FROM `アアア`;
+カカ キキキ ククク ケケケ
+NULL アアアアア NULL NULL
+NULL イイイイイ NULL NULL
+NULL ウウウウウ NULL NULL
+DESC `アアア`;
+Field Type Null Key Default Extra
+カカ char(1) YES MUL NULL
+キキキ char(6) NO PRI NULL
+ククク char(1) YES UNI NULL
+ケケケ char(1) YES NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `カカ` char(1) DEFAULT NULL,
+ `キキキ` char(6) NOT NULL,
+ `ククク` char(1) DEFAULT NULL,
+ `ケケケ` char(1) DEFAULT NULL,
+ PRIMARY KEY (`キキキ`),
+ UNIQUE KEY `ククク` (`ククク`),
+ KEY `カカカ` (`カカ`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `アアア` DROP INDEX `カカカ`;
+ALTER TABLE `アアア` DROP PRIMARY KEY;
+ALTER TABLE `アアア` DROP INDEX `ククク`;
+ALTER TABLE `アアア` DROP `カカ`;
+ALTER TABLE `アアア` DROP `ククク`;
+ALTER TABLE `アアア` DROP `ケケケ`;
+SELECT * FROM `アアア`;
+キキキ
+アアアアア
+イイイイイ
+ウウウウウ
+DESC `アアア`;
+Field Type Null Key Default Extra
+キキキ char(6) NO NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `キキキ` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `あああ` ADD `かかか` char(1) FIRST;
+ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`;
+ALTER TABLE `あああ` ADD `けけけ` char(1);
+ALTER TABLE `あああ` ADD INDEX (`かかか`);
+ALTER TABLE `あああ` ADD PRIMARY KEY (`ききき`);
+ALTER TABLE `あああ` ADD UNIQUE (`くくく`);
+ALTER TABLE `あああ` CHANGE `かかか` `かか` char(1);
+ALTER TABLE `あああ` MODIFY `ききき` char(6);
+SELECT * FROM `あああ`;
+かか ききき くくく けけけ
+NULL あああああ NULL NULL
+NULL いいいいい NULL NULL
+NULL ううううう NULL NULL
+DESC `あああ`;
+Field Type Null Key Default Extra
+かか char(1) YES MUL NULL
+ききき char(6) NO PRI NULL
+くくく char(1) YES UNI NULL
+けけけ char(1) YES NULL
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `かか` char(1) DEFAULT NULL,
+ `ききき` char(6) NOT NULL,
+ `くくく` char(1) DEFAULT NULL,
+ `けけけ` char(1) DEFAULT NULL,
+ PRIMARY KEY (`ききき`),
+ UNIQUE KEY `くくく` (`くくく`),
+ KEY `かかか` (`かか`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `あああ` DROP INDEX `かかか`;
+ALTER TABLE `あああ` DROP PRIMARY KEY;
+ALTER TABLE `あああ` DROP INDEX `くくく`;
+ALTER TABLE `あああ` DROP `かか`;
+ALTER TABLE `あああ` DROP `くくく`;
+ALTER TABLE `あああ` DROP `けけけ`;
+SELECT * FROM `あああ`;
+ききき
+あああああ
+いいいいい
+ううううう
+DESC `あああ`;
+Field Type Null Key Default Extra
+ききき char(6) NO NULL
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `ききき` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
+ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
+ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1);
+ALTER TABLE `龖龖龖` ADD INDEX (`丄丄丄`);
+ALTER TABLE `龖龖龖` ADD PRIMARY KEY (`丂丂丂`);
+ALTER TABLE `龖龖龖` ADD UNIQUE (`丅丅丅`);
+ALTER TABLE `龖龖龖` CHANGE `丄丄丄` `丄丄` char(1);
+ALTER TABLE `龖龖龖` MODIFY `丂丂丂` char(6);
+SELECT * FROM `龖龖龖`;
+丄丄 丂丂丂 丅丅丅 乚乚乚
+NULL 丂丂丂丂丂 NULL NULL
+NULL 丄丄丄丄丄 NULL NULL
+NULL 丅丅丅丅丅 NULL NULL
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丄丄 char(1) YES MUL NULL
+丂丂丂 char(6) NO PRI NULL
+丅丅丅 char(1) YES UNI NULL
+乚乚乚 char(1) YES NULL
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丄丄` char(1) DEFAULT NULL,
+ `丂丂丂` char(6) NOT NULL,
+ `丅丅丅` char(1) DEFAULT NULL,
+ `乚乚乚` char(1) DEFAULT NULL,
+ PRIMARY KEY (`丂丂丂`),
+ UNIQUE KEY `丅丅丅` (`丅丅丅`),
+ KEY `丄丄丄` (`丄丄`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`;
+ALTER TABLE `龖龖龖` DROP PRIMARY KEY;
+ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `丄丄`;
+ALTER TABLE `龖龖龖` DROP `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `乚乚乚`;
+SELECT * FROM `龖龖龖`;
+丂丂丂
+丂丂丂丂丂
+丄丄丄丄丄
+丅丅丅丅丅
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丂丂丂 char(6) NO NULL
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丂丂丂` char(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+CREATE TABLE `アアア`(`キキキ` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `イイイ`(`ケケケ` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `あああ`(`ききき` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `いいい`(`けけけ` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龗龗龗`(`乚乚乚` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+INSERT INTO `アアア` VALUES ('アアアアア'),('イイイイイ'),('ウウウウウ');
+INSERT INTO `あああ` VALUES ('あああああ'),('いいいいい'),('ううううう');
+INSERT INTO `龖龖龖` VALUES ('丂丂丂丂丂'),('丄丄丄丄丄'),('丅丅丅丅丅');
+ALTER TABLE `アアア` ADD `カカカ` char(1) FIRST;
+ALTER TABLE `アアア` ADD `ククク` char(1) AFTER `キキキ`;
+ALTER TABLE `アアア` ADD `ケケケ` char(1);
+ALTER TABLE `アアア` ADD INDEX (`カカカ`);
+ALTER TABLE `アアア` ADD PRIMARY KEY (`キキキ`);
+ALTER TABLE `アアア` ADD UNIQUE (`ククク`);
+ALTER TABLE `アアア` CHANGE `カカカ` `カカ` char(1);
+ALTER TABLE `アアア` MODIFY `キキキ` char(6);
+SELECT * FROM `アアア`;
+カカ キキキ ククク ケケケ
+NULL アアアアア NULL NULL
+NULL イイイイイ NULL NULL
+NULL ウウウウウ NULL NULL
+DESC `アアア`;
+Field Type Null Key Default Extra
+カカ char(1) YES MUL NULL
+キキキ char(6) NO PRI NULL
+ククク char(1) YES UNI NULL
+ケケケ char(1) YES NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `カカ` char(1) DEFAULT NULL,
+ `キキキ` char(6) NOT NULL,
+ `ククク` char(1) DEFAULT NULL,
+ `ケケケ` char(1) DEFAULT NULL,
+ PRIMARY KEY (`キキキ`),
+ UNIQUE KEY `ククク` (`ククク`),
+ KEY `カカカ` (`カカ`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `アアア` DROP INDEX `カカカ`;
+ALTER TABLE `アアア` DROP PRIMARY KEY;
+ALTER TABLE `アアア` DROP INDEX `ククク`;
+ALTER TABLE `アアア` DROP `カカ`;
+ALTER TABLE `アアア` DROP `ククク`;
+ALTER TABLE `アアア` DROP `ケケケ`;
+SELECT * FROM `アアア`;
+キキキ
+アアアアア
+イイイイイ
+ウウウウウ
+DESC `アアア`;
+Field Type Null Key Default Extra
+キキキ char(6) NO NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `キキキ` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `あああ` ADD `かかか` char(1) FIRST;
+ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`;
+ALTER TABLE `あああ` ADD `けけけ` char(1);
+ALTER TABLE `あああ` ADD INDEX (`かかか`);
+ALTER TABLE `あああ` ADD PRIMARY KEY (`ききき`);
+ALTER TABLE `あああ` ADD UNIQUE (`くくく`);
+ALTER TABLE `あああ` CHANGE `かかか` `かか` char(1);
+ALTER TABLE `あああ` MODIFY `ききき` char(6);
+SELECT * FROM `あああ`;
+かか ききき くくく けけけ
+NULL あああああ NULL NULL
+NULL いいいいい NULL NULL
+NULL ううううう NULL NULL
+DESC `あああ`;
+Field Type Null Key Default Extra
+かか char(1) YES MUL NULL
+ききき char(6) NO PRI NULL
+くくく char(1) YES UNI NULL
+けけけ char(1) YES NULL
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `かか` char(1) DEFAULT NULL,
+ `ききき` char(6) NOT NULL,
+ `くくく` char(1) DEFAULT NULL,
+ `けけけ` char(1) DEFAULT NULL,
+ PRIMARY KEY (`ききき`),
+ UNIQUE KEY `くくく` (`くくく`),
+ KEY `かかか` (`かか`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `あああ` DROP INDEX `かかか`;
+ALTER TABLE `あああ` DROP PRIMARY KEY;
+ALTER TABLE `あああ` DROP INDEX `くくく`;
+ALTER TABLE `あああ` DROP `かか`;
+ALTER TABLE `あああ` DROP `くくく`;
+ALTER TABLE `あああ` DROP `けけけ`;
+SELECT * FROM `あああ`;
+ききき
+あああああ
+いいいいい
+ううううう
+DESC `あああ`;
+Field Type Null Key Default Extra
+ききき char(6) NO NULL
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `ききき` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
+ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
+ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1);
+ALTER TABLE `龖龖龖` ADD INDEX (`丄丄丄`);
+ALTER TABLE `龖龖龖` ADD PRIMARY KEY (`丂丂丂`);
+ALTER TABLE `龖龖龖` ADD UNIQUE (`丅丅丅`);
+ALTER TABLE `龖龖龖` CHANGE `丄丄丄` `丄丄` char(1);
+ALTER TABLE `龖龖龖` MODIFY `丂丂丂` char(6);
+SELECT * FROM `龖龖龖`;
+丄丄 丂丂丂 丅丅丅 乚乚乚
+NULL 丂丂丂丂丂 NULL NULL
+NULL 丄丄丄丄丄 NULL NULL
+NULL 丅丅丅丅丅 NULL NULL
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丄丄 char(1) YES MUL NULL
+丂丂丂 char(6) NO PRI NULL
+丅丅丅 char(1) YES UNI NULL
+乚乚乚 char(1) YES NULL
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丄丄` char(1) DEFAULT NULL,
+ `丂丂丂` char(6) NOT NULL,
+ `丅丅丅` char(1) DEFAULT NULL,
+ `乚乚乚` char(1) DEFAULT NULL,
+ PRIMARY KEY (`丂丂丂`),
+ UNIQUE KEY `丅丅丅` (`丅丅丅`),
+ KEY `丄丄丄` (`丄丄`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`;
+ALTER TABLE `龖龖龖` DROP PRIMARY KEY;
+ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `丄丄`;
+ALTER TABLE `龖龖龖` DROP `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `乚乚乚`;
+SELECT * FROM `龖龖龖`;
+丂丂丂
+丂丂丂丂丂
+丄丄丄丄丄
+丅丅丅丅丅
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丂丂丂 char(6) NO NULL
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丂丂丂` char(6) NOT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
diff --git a/mysql-test/suite/jp/r/jp_charlength_sjis.result b/mysql-test/suite/jp/r/jp_charlength_sjis.result
new file mode 100644
index 00000000..5c734b4b
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charlength_sjis.result
@@ -0,0 +1,110 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sP`;
+bP CHAR_LENGTH(`bP`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sQ`;
+bP CHAR_LENGTH(`bP`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sR`;
+bP CHAR_LENGTH(`bP`)
+ 0
+\ 1
+\\ 2
+\\\ 3
+\\\\ 4
+\\\\\ 5
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sS`;
+bP CHAR_LENGTH(`bP`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sT`;
+bP CHAR_LENGTH(`bP`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sU`;
+bP CHAR_LENGTH(`bP`)
+ 0
+\ 1
+\\ 2
+\\\ 3
+\\\\ 4
+\\\\\ 5
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sV`;
+bP CHAR_LENGTH(`bP`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sW`;
+bP CHAR_LENGTH(`bP`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sX`;
+bP CHAR_LENGTH(`bP`)
+\\\\\ 5
+\\\\ 4
+\\\ 3
+\\ 2
+\ 1
+ 0
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_charlength_ucs2.result b/mysql-test/suite/jp/r/jp_charlength_ucs2.result
new file mode 100644
index 00000000..b211c87c
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charlength_ucs2.result
@@ -0,0 +1,111 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+܏ 2
+܏ݏ 3
+܏ݏޏ 4
+܏ݏޏߏ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+܏ 2
+܏ݏ 3
+܏ݏޏ 4
+܏ݏޏߏ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+܏ݏޏߏ 5
+܏ݏޏ 4
+܏ݏ 3
+܏ 2
+ 1
+ 0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_charlength_ujis.result b/mysql-test/suite/jp/r/jp_charlength_ujis.result
new file mode 100644
index 00000000..910952b4
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charlength_ujis.result
@@ -0,0 +1,110 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+܏ 2
+܏ݏ 3
+܏ݏޏ 4
+܏ݏޏߏ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 0
+ 1
+܏ 2
+܏ݏ 3
+܏ݏޏ 4
+܏ݏޏߏ 5
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+ã CHAR_LENGTH(`ã`)
+܏ݏޏߏ 5
+܏ݏޏ 4
+܏ݏ 3
+܏ 2
+ 1
+ 0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_charlength_utf8.result b/mysql-test/suite/jp/r/jp_charlength_utf8.result
new file mode 100644
index 00000000..473eb987
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charlength_utf8.result
@@ -0,0 +1,110 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T1`;
+C1 CHAR_LENGTH(`C1`)
+ 0
+ア 1
+アイ 2
+アイウ 3
+アイウエ 4
+アイウエオ 5
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T2`;
+C1 CHAR_LENGTH(`C1`)
+ 0
+あ 1
+あい 2
+あいう 3
+あいうえ 4
+あいうえお 5
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T3`;
+C1 CHAR_LENGTH(`C1`)
+ 0
+龔 1
+龔龖 2
+龔龖龗 3
+龔龖龗龞 4
+龔龖龗龞龡 5
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T4`;
+C1 CHAR_LENGTH(`C1`)
+ 0
+ア 1
+アイ 2
+アイウ 3
+アイウエ 4
+アイウエオ 5
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T5`;
+C1 CHAR_LENGTH(`C1`)
+ 0
+あ 1
+あい 2
+あいう 3
+あいうえ 4
+あいうえお 5
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T6`;
+C1 CHAR_LENGTH(`C1`)
+ 0
+龔 1
+龔龖 2
+龔龖龗 3
+龔龖龗龞 4
+龔龖龗龞龡 5
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T7`;
+C1 CHAR_LENGTH(`C1`)
+アイウエオ 5
+アイウエ 4
+アイウ 3
+アイ 2
+ア 1
+ 0
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T8`;
+C1 CHAR_LENGTH(`C1`)
+あいうえお 5
+あいうえ 4
+あいう 3
+あい 2
+あ 1
+ 0
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T9`;
+C1 CHAR_LENGTH(`C1`)
+龔龖龗龞龡 5
+龔龖龗龞 4
+龔龖龗 3
+龔龖 2
+龔 1
+ 0
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_charset_sjis.result b/mysql-test/suite/jp/r/jp_charset_sjis.result
new file mode 100644
index 00000000..06371a7d
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charset_sjis.result
@@ -0,0 +1,173 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(20)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20)) DEFAULT CHARSET = sjis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sP`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(`bP`) FROM `sQ`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(`bP`) FROM `sR`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sP`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sP`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sP`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sP`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sQ`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sQ`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sQ`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sQ`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sR`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sR`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sR`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sR`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`bP`) FROM `sS`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(`bP`) FROM `sT`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(`bP`) FROM `sU`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sS`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sS`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sS`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sS`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sT`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sT`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sT`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sT`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sU`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sU`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sU`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sU`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`bP`) FROM `sV`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(`bP`) FROM `sW`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(`bP`) FROM `sX`;
+CHARSET(`bP`)
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sV`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sV`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sV`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sV`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sW`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sW`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sW`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sW`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sX`;
+CHARSET(CONVERT(`bP` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sX`;
+CHARSET(CONVERT(`bP` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sX`;
+CHARSET(CONVERT(`bP` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sX`;
+CHARSET(CONVERT(`bP` USING ujis))
+ujis
+drop table `sP`;
+drop table `sQ`;
+drop table `sR`;
+drop table `sS`;
+drop table `sT`;
+drop table `sU`;
+drop table `sV`;
+drop table `sW`;
+drop table `sX`;
diff --git a/mysql-test/suite/jp/r/jp_charset_ucs2.result b/mysql-test/suite/jp/r/jp_charset_ucs2.result
new file mode 100644
index 00000000..71fb6125
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charset_ucs2.result
@@ -0,0 +1,230 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_charset_ujis.result b/mysql-test/suite/jp/r/jp_charset_ujis.result
new file mode 100644
index 00000000..327e16e8
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charset_ujis.result
@@ -0,0 +1,173 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+CHARSET(`ã`)
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+CHARSET(CONVERT(`ã` USING ujis))
+ujis
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_charset_utf8.result b/mysql-test/suite/jp/r/jp_charset_utf8.result
new file mode 100644
index 00000000..46b28596
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_charset_utf8.result
@@ -0,0 +1,173 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T1`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(`C1`) FROM `T2`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(`C1`) FROM `T3`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T1`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T1`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T1`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T1`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T2`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T2`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T2`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T2`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T3`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T3`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T3`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T3`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`C1`) FROM `T4`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(`C1`) FROM `T5`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(`C1`) FROM `T6`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T4`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T4`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T4`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T4`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T5`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T5`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T5`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T5`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T6`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T6`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T6`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T6`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(`C1`) FROM `T7`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(`C1`) FROM `T8`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(`C1`) FROM `T9`;
+CHARSET(`C1`)
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T7`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T7`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T7`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T7`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T8`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T8`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T8`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T8`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T9`;
+CHARSET(CONVERT(`C1` USING utf8))
+utf8mb3
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T9`;
+CHARSET(CONVERT(`C1` USING ucs2))
+ucs2
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T9`;
+CHARSET(CONVERT(`C1` USING sjis))
+sjis
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T9`;
+CHARSET(CONVERT(`C1` USING ujis))
+ujis
+drop table `T1`;
+drop table `T2`;
+drop table `T3`;
+drop table `T4`;
+drop table `T5`;
+drop table `T6`;
+drop table `T7`;
+drop table `T8`;
+drop table `T9`;
diff --git a/mysql-test/suite/jp/r/jp_convert_sjis.result b/mysql-test/suite/jp/r/jp_convert_sjis.result
new file mode 100644
index 00000000..abb0c28f
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_convert_sjis.result
@@ -0,0 +1,785 @@
+SET NAMES sjis;
+SET character_set_database = sjis;
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sP`;
+bP CONVERT(`bP` using utf8)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sP`;
+bP CONVERT(`bP` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sP`;
+bP CONVERT(`bP` using ujis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sQ`;
+bP CONVERT(`bP` using utf8)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEEEE EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEE EEEEEE
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEEEEEE EEEEEEEEE
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+EEEEEEE EEEEEEE
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sQ`;
+bP CONVERT(`bP` using ucs2)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEEEE EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEE EEEEEE
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEEEEEE EEEEEEEEE
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+EEEEEEE EEEEEEE
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sQ`;
+bP CONVERT(`bP` using ujis)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEEEE EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEE EEEEEE
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEEEEEE EEEEEEEEE
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+EEEEEEE EEEEEEE
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sR`;
+bP CONVERT(`bP` using utf8)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sR`;
+bP CONVERT(`bP` using ucs2)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sR`;
+bP CONVERT(`bP` using ujis)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sS`;
+bP CONVERT(`bP` using utf8)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sS`;
+bP CONVERT(`bP` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sS`;
+bP CONVERT(`bP` using ujis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sT`;
+bP CONVERT(`bP` using utf8)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEEEE EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEE EEEEEE
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEEEEEE EEEEEEEEE
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+EEEEEEE EEEEEEE
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sT`;
+bP CONVERT(`bP` using ucs2)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEEEE EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEE EEEEEE
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEEEEEE EEEEEEEEE
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+EEEEEEE EEEEEEE
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sT`;
+bP CONVERT(`bP` using ujis)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEEEE EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEE EEEEEE
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E E
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEEEEEE EEEEEEEEE
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+EEEEEEE EEEEEEE
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sU`;
+bP CONVERT(`bP` using utf8)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sU`;
+bP CONVERT(`bP` using ucs2)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sU`;
+bP CONVERT(`bP` using ujis)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sV`;
+bP CONVERT(`bP` using utf8)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sV`;
+bP CONVERT(`bP` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sV`;
+bP CONVERT(`bP` using ujis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[_]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+
+
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sW`;
+bP CONVERT(`bP` using utf8)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+EEEEEE EEEEEE
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEE EEEEE
+EEEEEEEEE EEEEEEEEE
+E E
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+E E
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+E E
+EEEEEEE EEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E E
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E E
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sW`;
+bP CONVERT(`bP` using ucs2)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+EEEEEE EEEEEE
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEE EEEEE
+EEEEEEEEE EEEEEEEEE
+E E
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+E E
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+E E
+EEEEEEE EEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E E
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E E
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sW`;
+bP CONVERT(`bP` using ujis)
+@@ABCDEFGHIJKLMNOPQR @@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{]}~ {]}~
+EEEEE EEEEE
+EEEEEE EEEEEE
+EEEEEEEEEEEE EEEEEEEEEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE EEȁɁʁˁ́́΁EEEEEEEEEEE
+ځہ܁݁ށ߁EEEEE ځہ܁݁ށ߁EEEEE
+EEEEEEEEEE@ EEEEEEEEEE@
+EEEEEEEEEEEEEEEEOPQR EEEEEEEEEEEEEEEEOPQR
+STUVWXEEEEEEE`abcdef STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE ghijklmnopqrstuvwxyE
+EEEEE EEEEE
+EEEEEEEEE EEEEEEEEE
+E E
+‚ÂĂ ‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂ ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂ ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEE EEEEEEEEEEEEE
+E E
+EEEEEEEEƒÃă EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`EEEEEE STUVWXYZ[\]^_`EEEEEE
+EEEEEEEEEpqrstuvwxyz EEEEEEEEEpqrstuvwxyz
+{|}~ {|}~
+EEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEE
+E E
+EEEEEEE EEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E E
+ˆÈĈ ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈ ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈ ڈۈ܈݈ވ߈
+EEEEE EEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE ghijklmnopqrEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+E E
+˜ØĘ ˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ ژۘܘݘޘߘ
+EEEEE EEEEE
+E@ABCDEFGHIJKLMNOPQR E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz ghijklmnopqrstuvwxyz
+{|}~ {|}~
+ꞁEEEEE ꞁEEEEE
+E꤁EEEEEEEEEEEEE E꤁EEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEE
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sX`;
+bP CONVERT(`bP` using utf8)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sX`;
+bP CONVERT(`bP` using ucs2)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sX`;
+bP CONVERT(`bP` using ujis)
+\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
+drop table `sP`;
+drop table `sQ`;
+drop table `sR`;
+drop table `sS`;
+drop table `sT`;
+drop table `sU`;
+drop table `sV`;
+drop table `sW`;
+drop table `sX`;
diff --git a/mysql-test/suite/jp/r/jp_convert_ucs2.result b/mysql-test/suite/jp/r/jp_convert_ucs2.result
new file mode 100644
index 00000000..842ddfa2
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_convert_ucs2.result
@@ -0,0 +1,345 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ \¡áġšơ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ \¡áġšơ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ \¡áġšơ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+~Ïġ ~Ïġ
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+~Ïġ ~Ïġ
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+~Ïġ ??~?????
+ ???????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ????????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+Warnings:
+Warning 1977 Cannot convert 'ucs2' character 0x02DB to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ \¡áġšơ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ \¡áġšơ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ \¡áġšơ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+~Ïġ ~Ïġ
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+~Ïġ ~Ïġ
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+~Ïġ ??~?????
+ ???????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ????????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+Warnings:
+Warning 1977 Cannot convert 'ucs2' character 0x02DB to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+\¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+\¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+\¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+~Ïġ ~Ïġ
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+~Ïġ ~Ïġ
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+~Ïġ ??~?????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ????????????????????
+ ???????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+Warnings:
+Warning 1977 Cannot convert 'ucs2' character 0x02DB to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4E5A to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4EE1 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x4F19 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9EF8 to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F2B to 'sjis'
+Warning 1977 Cannot convert 'ucs2' character 0x9F57 to 'sjis'
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_convert_ujis.result b/mysql-test/suite/jp/r/jp_convert_ujis.result
new file mode 100644
index 00000000..d47f6b4e
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_convert_ujis.result
@@ -0,0 +1,1232 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+񡦡 񡦡
+ȏɏʏˏ̏͏Ρ ȏɏʏˏ̏͏Ρ
+ȏɏʏˏ̏͏ΏϏС ȏɏʏˏ̏͏ΏϏС
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+áŏƏ áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦 ܏ݏޏߏ㡦
+Ïġ ~Ïġ
+
+
+
+
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+ÏďŏƏ ÏďŏƏ
+ÏďŏƏ ÏďŏƏ
+
+돢쏢폢 돢쏢폢
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+񡦡 񡦡
+ȏɏʏˏ̏͏Ρ ȏɏʏˏ̏͏Ρ
+ȏɏʏˏ̏͏ΏϏС ȏɏʏˏ̏͏ΏϏС
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+áŏƏ áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦 ܏ݏޏߏ㡦
+Ïġ ~Ïġ
+
+
+
+
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+ÏďŏƏ ÏďŏƏ
+ÏďŏƏ ÏďŏƏ
+
+돢쏢폢 돢쏢폢
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+񡦡 ??
+ȏɏʏˏ̏͏Ρ ???????
+ȏɏʏˏ̏͏ΏϏС ?????????
+ÏďŏƏ ???????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ????????????????????
+ ????????
+áŏƏ ??????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ????????????????????
+ ????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ????????????????????
+ ???????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏ㡦 ????????
+Ïġ ??~?????
+ ????????????
+ ???????????
+ ???????????????????
+ ???????????????????
+ ???????????????????
+ ???????????????????
+ ?????????????
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 ?????????
+ÏďŏƏ ???????
+ÏďŏƏ ??????
+ ?????
+돢쏢폢 ?????
+
+
+
+
+
+
+
+
+
+Warnings:
+Warning 1977 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+񡦡 񡦡
+ȏɏʏˏ̏͏Ρ ȏɏʏˏ̏͏Ρ
+ȏɏʏˏ̏͏ΏϏС ȏɏʏˏ̏͏ΏϏС
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+áŏƏ áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦 ܏ݏޏߏ㡦
+Ïġ ~Ïġ
+
+
+
+
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+ÏďŏƏ ÏďŏƏ
+ÏďŏƏ ÏďŏƏ
+
+돢쏢폢 돢쏢폢
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+񡦡 񡦡
+ȏɏʏˏ̏͏Ρ ȏɏʏˏ̏͏Ρ
+ȏɏʏˏ̏͏ΏϏС ȏɏʏˏ̏͏ΏϏС
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+áŏƏ áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦 ܏ݏޏߏ㡦
+Ïġ ~Ïġ
+
+
+
+
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+ÏďŏƏ ÏďŏƏ
+ÏďŏƏ ÏďŏƏ
+
+돢쏢폢 돢쏢폢
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+񡦡 ??
+ȏɏʏˏ̏͏Ρ ???????
+ȏɏʏˏ̏͏ΏϏС ?????????
+ÏďŏƏ ???????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ????????????????????
+ ????????
+áŏƏ ??????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ????????????????????
+ ????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ????????????????????
+ ???????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏ㡦 ????????
+Ïġ ??~?????
+ ????????????
+ ???????????
+ ???????????????????
+ ???????????????????
+ ???????????????????
+ ???????????????????
+ ?????????????
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 ?????????
+ÏďŏƏ ???????
+ÏďŏƏ ??????
+ ?????
+돢쏢폢 ?????
+
+
+
+
+
+
+
+
+
+Warnings:
+Warning 1977 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+
+
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+
+
+
+
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+
+
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+
+
+
+
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+
+¡áġšơ \¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ ܡޡߡ
+
+
+
+ʢˢ̢͢΢ϢС ʢˢ̢͢΢ϢС
+ܢݢޢߢꡦ ܢݢޢߢꡦ
+
+
+£ãģţƣ £ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+
+
+¤äĤŤƤ ¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ ܤݤޤߤ
+󡦡 󡦡
+
+¥åĥťƥ ¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ ܥݥޥߥ
+
+
+¦æĦŦƦ ¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ ѧҧӧԧէ֧קا٧ڧ
+ܧݧާߧ ܧݧާߧ
+񡦡 񡦡
+
+
+
+
+
+
+°ðİŰư °ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰ ܰݰް߰
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+ӡ ӡ
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг СТУФХЦЧШЩЪЫЬЭЮЯабвг
+дежзийклмноп дежзийклмноп
+
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+ã CONVERT(`ã` using utf8)
+
+Ïġ ~Ïġ
+
+돢쏢폢 돢쏢폢
+񡦡 񡦡
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏Ρ ȏɏʏˏ̏͏Ρ
+
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏС ȏɏʏˏ̏͏ΏϏС
+
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+
+áŏƏ áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦 ܏ݏޏߏ㡦
+
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+ã CONVERT(`ã` using ucs2)
+
+Ïġ ~Ïġ
+
+돢쏢폢 돢쏢폢
+񡦡 񡦡
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏Ρ ȏɏʏˏ̏͏Ρ
+
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏС ȏɏʏˏ̏͏ΏϏС
+
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+
+áŏƏ áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+
+ÏďŏƏ ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦 ܏ݏޏߏ㡦
+
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+ã CONVERT(`ã` using sjis)
+ ?????
+Ïġ ??~?????
+
+돢쏢폢 ?????
+񡦡 ??
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦 ?????????
+ ????????????
+
+ÏďŏƏ ??????
+ȏɏʏˏ̏͏Ρ ???????
+
+ ?????????????
+ ???????????
+ÏďŏƏ ???????
+ȏɏʏˏ̏͏ΏϏС ?????????
+
+
+ ???????????????????
+ÏďŏƏ ???????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪 ????????????????????
+ ????????
+ ???????????????????
+áŏƏ ??????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫 ????????????????????
+ ????????
+ ???????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰 ????????????????????
+ ???????????????
+ ???????????????????
+ÏďŏƏ ????????????????????
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ ????????????????????
+܏ݏޏߏ㡦 ????????
+
+Warnings:
+Warning 1977 Cannot convert 'ujis' character 0x8FA2AF to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2B5 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2EB to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA2F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6E1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA6F1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA7F2 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FA9C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAADC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FAAF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABDC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FABF0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0A1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0B4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0C8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0DC to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FB0F0 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDA1 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDB4 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDC8 to 'sjis'
+Warning 1977 Cannot convert 'ujis' character 0x8FEDDC to 'sjis'
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_convert_utf8.result b/mysql-test/suite/jp/r/jp_convert_utf8.result
new file mode 100644
index 00000000..74776c16
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_convert_utf8.result
@@ -0,0 +1,1250 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T1`;
+C1 CONVERT(`C1` using ujis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T1`;
+C1 CONVERT(`C1` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T1`;
+C1 CONVERT(`C1` using sjis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T2`;
+C1 CONVERT(`C1` using ujis)
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/?〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBCBC to 'ujis'
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T2`;
+C1 CONVERT(`C1` using ucs2)
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T2`;
+C1 CONVERT(`C1` using sjis)
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/?〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBCBC to 'sjis'
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T3`;
+C1 CONVERT(`C1` using ujis)
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ĵķĺľļńňņñóòöôǒőōõŕřŗ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・ ǖŵýÿŷźžż・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・ ¤№・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・ łŀʼnŋøœßŧþ・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+・áàäâăǎāąåãćĉčçċďéèë ・áàäâăǎāąåãćĉčçċďéèë
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・˛˚?΄΅・・・・・・・・¡¦¿・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・άέήίϊΐόςύϋΰώ・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・ђѓєѕіїјљњћќўџ・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・æđðħıijĸ
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・ЂЃЄЅІЇ
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・ºª©®™
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ 佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBD9E to 'ujis'
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T3`;
+C1 CONVERT(`C1` using ucs2)
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ĵķĺľļńňņñóòöôǒőōõŕřŗ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・ ǖŵýÿŷźžż・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・ ¤№・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・ łŀʼnŋøœßŧþ・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+・áàäâăǎāąåãćĉčçċďéèë ・áàäâăǎāąåãćĉčçċďéèë
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・άέήίϊΐόςύϋΰώ・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・ђѓєѕіїјљњћќўџ・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・æđðħıijĸ
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・ЂЃЄЅІЇ
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・ºª©®™
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ 佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T3`;
+C1 CONVERT(`C1` using sjis)
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ ????????・???????・???
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ?????・??????????????
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ????????????????????
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ????????????????????
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ????????????????????
+śŝšşťţúùüûŭǔűūųůũǘǜǚ ????????????????????
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・ ??・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・ ?????????・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ???????・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・???????????????????
+・áàäâăǎāąåãćĉčçċďéèë ・???????????????????
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・??・?・?・??・???・??・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・?????・・・・・・・・???・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・????????????・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・?????????????・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・?????・?・??・?・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・???????
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・??????
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・?????
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・?????
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・???????????????????
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・???????????????????
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 ????????????????????
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 ????????????????????
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 ????????????????????
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ ???????????????・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 ????????????????????
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3AA to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC38A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC4B4 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC4B5 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC59A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC59B to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC795 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC796 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC2A4 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC582 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD088 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC381 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3A1 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC386 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCB9B to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCEAC to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD192 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCE86 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3A6 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD082 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC2BA to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCB98 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4B882 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BBB8 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4B99A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BBA1 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BC99 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BD9F to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BCAB to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BD97 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BE94 to 'sjis'
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T4`;
+C1 CONVERT(`C1` using ujis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T4`;
+C1 CONVERT(`C1` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T4`;
+C1 CONVERT(`C1` using sjis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+abcdefghijklmno abcdefghijklmno
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T5`;
+C1 CONVERT(`C1` using ujis)
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/?〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBCBC to 'ujis'
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T5`;
+C1 CONVERT(`C1` using ucs2)
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T5`;
+C1 CONVERT(`C1` using sjis)
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/?〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBCBC to 'sjis'
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T6`;
+C1 CONVERT(`C1` using ujis)
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ĵķĺľļńňņñóòöôǒőōõŕřŗ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・ ǖŵýÿŷźžż・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・ ¤№・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・ łŀʼnŋøœßŧþ・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+・áàäâăǎāąåãćĉčçċďéèë ・áàäâăǎāąåãćĉčçċďéèë
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・˛˚?΄΅・・・・・・・・¡¦¿・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・άέήίϊΐόςύϋΰώ・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・ђѓєѕіїјљњћќўџ・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・æđðħıijĸ
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・ЂЃЄЅІЇ
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・ºª©®™
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ 佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBD9E to 'ujis'
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T6`;
+C1 CONVERT(`C1` using ucs2)
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ĵķĺľļńňņñóòöôǒőōõŕřŗ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・ ǖŵýÿŷźžż・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・ ¤№・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・ łŀʼnŋøœßŧþ・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+・áàäâăǎāąåãćĉčçċďéèë ・áàäâăǎāąåãćĉčçċďéèë
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・άέήίϊΐόςύϋΰώ・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・ђѓєѕіїјљњћќўџ・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・æđðħıijĸ
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・ЂЃЄЅІЇ
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・ºª©®™
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ 佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T6`;
+C1 CONVERT(`C1` using sjis)
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ ????????・???????・???
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ?????・??????????????
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ????????????????????
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ????????????????????
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ????????????????????
+śŝšşťţúùüûŭǔűūųůũǘǜǚ ????????????????????
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・ ??・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・ ?????????・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ???????・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・???????????????????
+・áàäâăǎāąåãćĉčçċďéèë ・???????????????????
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・??・?・?・??・???・??・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・?????・・・・・・・・???・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・????????????・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・?????????????・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・?????・?・??・?・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・???????
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・??????
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・?????
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・?????
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・???????????????????
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・???????????????????
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 ????????????????????
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 ????????????????????
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 ????????????????????
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ ???????????????・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 ????????????????????
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3AA to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC38A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC4B4 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC4B5 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC59A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC59B to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC795 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC796 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC2A4 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC582 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD088 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC381 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3A1 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC386 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCB9B to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCEAC to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD192 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCE86 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3A6 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD082 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC2BA to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCB98 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4B882 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BBB8 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4B99A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BBA1 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BC99 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BD9F to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BCAB to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BD97 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BE94 to 'sjis'
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T7`;
+C1 CONVERT(`C1` using ujis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T7`;
+C1 CONVERT(`C1` using ucs2)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T7`;
+C1 CONVERT(`C1` using sjis)
+ !"#$%&'()*+,-./ !"#$%&'()*+,-./
+0123456789:;<=>? 0123456789:;<=>?
+@ABCDEFGHIJKLMNO @ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_ PQRSTUVWXYZ[\]^_
+abcdefghijklmno abcdefghijklmno
+pqrstuvwxyz{|}~ pqrstuvwxyz{|}~
+ 。「」、・ヲァィゥェォャュョッ 。「」、・ヲァィゥェォャュョッ
+ーアイウエオカキクケコサシスセソ ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚ ミムメモヤユヨラリルレロワン゙゚
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T8`;
+C1 CONVERT(`C1` using ujis)
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/?〜‖|…‥‘’
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBCBC to 'ujis'
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T8`;
+C1 CONVERT(`C1` using ucs2)
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T8`;
+C1 CONVERT(`C1` using sjis)
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ   、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’ ヾゝゞ〃仝々〆〇ー―‐/?〜‖|…‥‘’
+“”()〔〕[]{}〈〉《》「」『』【】 “”()〔〕[]{}〈〉《》「」『』【】
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥ +‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+$¢£%#&*@§☆★○●◎◇・・・・・ $¢£%#&*@§☆★○●◎◇・・・・・
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・ ・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・ ・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・ ・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・ ∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+・・ʼn♯♭♪†‡¶・・・・◯・・・・  ・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・・・・・・・・・・・・・・・0123 ・・・・・・・・・・・・・・・・0123
+456789・・・・・・・ABCDEFG 456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・ HIJKLMNOPQRSTUVWXYZ・
+・・・・・abcdefghijklmno ・・・・・abcdefghijklmno
+pqrstuvwxyz・・・・・・・・・ pqrstuvwxyz・・・・・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ ・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+ごさざしじすずせぜそぞただちぢっつづてで ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・ ゐゑをん・・・・・・・・・・・・・・・・
+・ァアィイゥウェエォオカガキギクグケゲコ ・ァアィイゥウェエォオカガキギクグケゲコ
+ゴサザシジスズセゼソゾタダチヂッツヅテデ ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・ ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ ・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+ΥΦΧΨΩ・・・・・・・・αβγδεζη ΥΦΧΨΩ・・・・・・・・αβγδεζη
+θικλμνξοπρστυφχψω・・・ θικλμνξοπρστυφχψω・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・АБВГДЕЁЖЗИЙКЛМНОПРС ・АБВГДЕЁЖЗИЙКЛМНОПРС
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・ ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+・・・・・・・・・абвгдеёжзий ・・・・・・・・・абвгдеёжзий
+клмнопрстуфхцчшщъыьэ клмнопрстуфхцчшщъыьэ
+юя・・・・・・・・・・・・・・・・・・ юя・・・・・・・・・・・・・・・・・・
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳ ・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・ ┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵 ・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇 梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異 鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸 移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・ 稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏 ・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑 牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・ 枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞 ・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛 亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛 佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆 俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・ 偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻 ・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈 鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝 麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒 黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・ 齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+・堯槇遙瑤凜熙・・・・・・・・・・・・・ ・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBCBC to 'sjis'
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T9`;
+C1 CONVERT(`C1` using ujis)
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・˛˚?΄΅・・・・・・・・¡¦¿・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・ºª©®™
+¤№・・・・・・・・・・・・・・・・・・ ¤№・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・άέήίϊΐόςύϋΰώ・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・ЂЃЄЅІЇ
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・ђѓєѕіїјљњћќўџ・・・・・
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・æđðħıijĸ
+łŀʼnŋøœßŧþ・・・・・・・・・・・ łŀʼnŋøœßŧþ・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+・áàäâăǎāąåãćĉčçċďéèë ・áàäâăǎāąåãćĉčçċďéèë
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ĵķĺľļńňņñóòöôǒőōõŕřŗ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǖŵýÿŷźžż・・・・・・・・・・・・ ǖŵýÿŷźžż・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ 佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xEFBD9E to 'ujis'
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T9`;
+C1 CONVERT(`C1` using ucs2)
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・ºª©®™
+¤№・・・・・・・・・・・・・・・・・・ ¤№・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・άέήίϊΐόςύϋΰώ・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・ЂЃЄЅІЇ
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・ђѓєѕіїјљњћќўџ・・・・・
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・æđðħıijĸ
+łŀʼnŋøœßŧþ・・・・・・・・・・・ łŀʼnŋøœßŧþ・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+・áàäâăǎāąåãćĉčçċďéèë ・áàäâăǎāąåãćĉčçċďéèë
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ĵķĺľļńňņñóòöôǒőōõŕřŗ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǖŵýÿŷźžż・・・・・・・・・・・・ ǖŵýÿŷźžż・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ 佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ 龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T9`;
+C1 CONVERT(`C1` using sjis)
+・・・・・・・・・・・・・・・˘ˇ¸˙˝ ・・・・・・・・・・・・・・・?????
+・˛˚~΄΅・・・・・・・・¡¦¿・・・ ・?????・・・・・・・・???・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・ºª©®™ ・・・・・・・・・・・・・・・?????
+¤№・・・・・・・・・・・・・・・・・・ ??・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・ ・・・・・?????・?・??・?・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・ ・????????????・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・ЂЃЄЅІЇ ・・・・・・・・・・・・・・??????
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・ ???????・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・ ・・?????????????・・・・・
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・ ・??・?・?・??・???・??・・・
+・・・・・・・・・・・・・æđðħıijĸ ・・・・・・・・・・・・・???????
+łŀʼnŋøœßŧþ・・・・・・・・・・・ ?????????・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË ・???????????????????
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ ?????・??????????????
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ ????????????????????
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ ????????????????????
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+・áàäâăǎāąåãćĉčçċďéèë ・???????????????????
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ ????????・???????・???
+ĵķĺľļńňņñóòöôǒőōõŕřŗ ????????????????????
+śŝšşťţúùüûŭǔűūųůũǘǜǚ ????????????????????
+ǖŵýÿŷźžż・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑 ・???????????????????
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠 ????????????????????
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众 ????????????????????
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘 ????????????????????
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・ ???????????????・・・・・
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪 ・???????????????????
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖 ????????????????????
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒 ????????????????????
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・ ????????・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・・・・
+Warnings:
+Warning 1977 Cannot convert 'utf8mb3' character 0xCB98 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCB9B to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC2BA to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC2A4 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCE86 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xCEAC to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD082 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD088 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xD192 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC386 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3A6 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC582 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC381 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC38A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC4B4 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC59A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC795 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3A1 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC3AA to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC4B5 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC59B to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xC796 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4B882 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4B99A to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BBA1 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BC99 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE4BD9F to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BBB8 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BCAB to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BD97 to 'sjis'
+Warning 1977 Cannot convert 'utf8mb3' character 0xE9BE94 to 'sjis'
+drop table `T1`;
+drop table `T2`;
+drop table `T3`;
+drop table `T4`;
+drop table `T5`;
+drop table `T6`;
+drop table `T7`;
+drop table `T8`;
+drop table `T9`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_sjis.result b/mysql-test/suite/jp/r/jp_create_db_sjis.result
new file mode 100644
index 00000000..d1262a63
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_db_sjis.result
@@ -0,0 +1,24 @@
+SET NAMES sjis;
+SET character_set_database = sjis;
+drop database if exists `ݺ`;
+drop database if exists `{`;
+drop database if exists `\\\`;
+CREATE DATABASE `ݺ`;
+CREATE DATABASE `{`;
+CREATE DATABASE `\\\`;
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+schema_name
+information_schema
+mysql
+performance_schema
+sys
+test
+\\\
+{
+USE `ݺ`;
+USE `{`;
+USE `\\\`;
+DROP DATABASE `ݺ`;
+DROP DATABASE `{`;
+DROP DATABASE `\\\`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_ucs2.result b/mysql-test/suite/jp/r/jp_create_db_ucs2.result
new file mode 100644
index 00000000..c8ddd007
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_db_ucs2.result
@@ -0,0 +1,25 @@
+drop database if exists `ƎΎݎ`;
+drop database if exists `ܸ`;
+drop database if exists `܏ݏ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET character_set_server = ucs2;
+CREATE DATABASE `ƎΎݎ`;
+CREATE DATABASE `ܸ`;
+CREATE DATABASE `܏ݏ`;
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+schema_name
+information_schema
+mysql
+performance_schema
+sys
+test
+܏ݏ
+ƎΎݎ
+USE `ƎΎݎ`;
+USE `ܸ`;
+USE `܏ݏ`;
+DROP DATABASE `ƎΎݎ`;
+DROP DATABASE `ܸ`;
+DROP DATABASE `܏ݏ`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_ujis.result b/mysql-test/suite/jp/r/jp_create_db_ujis.result
new file mode 100644
index 00000000..af2e809d
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_db_ujis.result
@@ -0,0 +1,24 @@
+drop database if exists `ƎΎݎ`;
+drop database if exists `ܸ`;
+drop database if exists `܏ݏ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE DATABASE `ƎΎݎ`;
+CREATE DATABASE `ܸ`;
+CREATE DATABASE `܏ݏ`;
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+schema_name
+information_schema
+mysql
+performance_schema
+sys
+test
+܏ݏ
+ƎΎݎ
+USE `ƎΎݎ`;
+USE `ܸ`;
+USE `܏ݏ`;
+DROP DATABASE `ƎΎݎ`;
+DROP DATABASE `ܸ`;
+DROP DATABASE `܏ݏ`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_utf8.result b/mysql-test/suite/jp/r/jp_create_db_utf8.result
new file mode 100644
index 00000000..a77c4c5e
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_db_utf8.result
@@ -0,0 +1,24 @@
+drop database if exists `ニホンゴ`;
+drop database if exists `日本語`;
+drop database if exists `龔龖龗`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE DATABASE `ニホンゴ`;
+CREATE DATABASE `日本語`;
+CREATE DATABASE `龔龖龗`;
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+schema_name
+information_schema
+mysql
+performance_schema
+sys
+test
+日本語
+龔龖龗
+ニホンゴ
+USE `ニホンゴ`;
+USE `日本語`;
+USE `龔龖龗`;
+DROP DATABASE `ニホンゴ`;
+DROP DATABASE `日本語`;
+DROP DATABASE `龔龖龗`;
diff --git a/mysql-test/suite/jp/r/jp_create_tbl_sjis.result b/mysql-test/suite/jp/r/jp_create_tbl_sjis.result
new file mode 100644
index 00000000..0a78d26e
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_tbl_sjis.result
@@ -0,0 +1,521 @@
+SET NAMES sjis;
+SET character_set_database = sjis;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+Warnings:
+Note 1050 Table '\\\' already exists
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+Warnings:
+Note 1050 Table '\\\' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\`char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TEMPORARY TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TEMPORARY TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+Warnings:
+Note 1050 Table '\\\' already exists
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+Warnings:
+Note 1050 Table '\\\' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\`char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TEMPORARY TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TEMPORARY TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+Warnings:
+Note 1050 Table '\\\' already exists
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+Warnings:
+Note 1050 Table '\\\' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\`char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+DESC `\\\`;
+Field Type Null Key Default Extra
+\\\ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TEMPORARY TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `\\\`;
+Table Create Table
+\\\ CREATE TEMPORARY TABLE `\\\` (
+ `\\\` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
diff --git a/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result b/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result
new file mode 100644
index 00000000..d9dca059
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_tbl_ucs2.result
@@ -0,0 +1,521 @@
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+DROP TABLE IF EXISTS `ߏߏ`;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+Warnings:
+Note 1050 Table 'ݏݏ' already exists
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+Warnings:
+Note 1050 Table 'ޏޏ' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ޏޏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ߏߏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ޏޏ`;
+Table Create Table
+ޏޏ CREATE TABLE `ޏޏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ߏߏ`;
+Table Create Table
+ߏߏ CREATE TABLE `ߏߏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+Warnings:
+Note 1050 Table 'ݏݏ' already exists
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+Warnings:
+Note 1050 Table 'ޏޏ' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ޏޏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ߏߏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ޏޏ`;
+Table Create Table
+ޏޏ CREATE TABLE `ޏޏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ߏߏ`;
+Table Create Table
+ߏߏ CREATE TABLE `ߏߏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+Warnings:
+Note 1050 Table 'ݏݏ' already exists
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+Warnings:
+Note 1050 Table 'ޏޏ' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ޏޏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ߏߏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ޏޏ`;
+Table Create Table
+ޏޏ CREATE TABLE `ޏޏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ߏߏ`;
+Table Create Table
+ߏߏ CREATE TABLE `ߏߏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
diff --git a/mysql-test/suite/jp/r/jp_create_tbl_ujis.result b/mysql-test/suite/jp/r/jp_create_tbl_ujis.result
new file mode 100644
index 00000000..d1f247fc
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_tbl_ujis.result
@@ -0,0 +1,521 @@
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+DROP TABLE IF EXISTS `ߏߏ`;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+Warnings:
+Note 1050 Table 'ݏݏ' already exists
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+Warnings:
+Note 1050 Table 'ޏޏ' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ޏޏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ߏߏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ޏޏ`;
+Table Create Table
+ޏޏ CREATE TABLE `ޏޏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ߏߏ`;
+Table Create Table
+ߏߏ CREATE TABLE `ߏߏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+Warnings:
+Note 1050 Table 'ݏݏ' already exists
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+Warnings:
+Note 1050 Table 'ޏޏ' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ޏޏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ߏߏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ޏޏ`;
+Table Create Table
+ޏޏ CREATE TABLE `ޏޏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ߏߏ`;
+Table Create Table
+ߏߏ CREATE TABLE `ߏߏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+Warnings:
+Note 1050 Table '' already exists
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+Warnings:
+Note 1050 Table 'ݏݏ' already exists
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+Warnings:
+Note 1050 Table 'ޏޏ' already exists
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ݏݏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ޏޏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC `ߏߏ`;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+DESC ``;
+Field Type Null Key Default Extra
+ char(1) YES NULL
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ݏݏ`;
+Table Create Table
+ݏݏ CREATE TABLE `ݏݏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ޏޏ`;
+Table Create Table
+ޏޏ CREATE TABLE `ޏޏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ߏߏ`;
+Table Create Table
+ߏߏ CREATE TABLE `ߏߏ` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE ``;
+Table Create Table
+ CREATE TEMPORARY TABLE `` (
+ `` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
diff --git a/mysql-test/suite/jp/r/jp_create_tbl_utf8.result b/mysql-test/suite/jp/r/jp_create_tbl_utf8.result
new file mode 100644
index 00000000..13958490
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_create_tbl_utf8.result
@@ -0,0 +1,521 @@
+DROP TABLE IF EXISTS `アアア`;
+DROP TABLE IF EXISTS `イイイ`;
+DROP TABLE IF EXISTS `ウウウ`;
+DROP TABLE IF EXISTS `エエエ`;
+DROP TABLE IF EXISTS `オオオ`;
+DROP TABLE IF EXISTS `あああ`;
+DROP TABLE IF EXISTS `いいい`;
+DROP TABLE IF EXISTS `ううう`;
+DROP TABLE IF EXISTS `えええ`;
+DROP TABLE IF EXISTS `おおお`;
+DROP TABLE IF EXISTS `龖龖龖`;
+DROP TABLE IF EXISTS `龗龗龗`;
+DROP TABLE IF EXISTS `龞龞龞`;
+DROP TABLE IF EXISTS `龡龡龡`;
+DROP TABLE IF EXISTS `龢龢龢`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+Warnings:
+Note 1050 Table 'アアア' already exists
+CREATE TABLE IF NOT EXISTS `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+Warnings:
+Note 1050 Table 'イイイ' already exists
+CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+Warnings:
+Note 1050 Table 'あああ' already exists
+CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+Warnings:
+Note 1050 Table 'いいい' already exists
+CREATE TABLE IF NOT EXISTS `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+Warnings:
+Note 1050 Table '龖龖龖' already exists
+CREATE TABLE IF NOT EXISTS `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+Warnings:
+Note 1050 Table '龗龗龗' already exists
+CREATE TABLE IF NOT EXISTS `ウウウ`(`ククク` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `龞龞龞`(`丅丅丅`char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `エエエ`(`ケケケ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `オオオ`(`コココ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `えええ`(`けけけ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `おおお`(`こここ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `龡龡龡`(`丌丌丌` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `龢龢龢`(`丒丒丒` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+DESC `アアア`;
+Field Type Null Key Default Extra
+カカカ char(1) YES NULL
+DESC `イイイ`;
+Field Type Null Key Default Extra
+キキキ char(1) YES NULL
+DESC `ウウウ`;
+Field Type Null Key Default Extra
+ククク char(1) YES NULL
+DESC `エエエ`;
+Field Type Null Key Default Extra
+ケケケ char(1) YES NULL
+DESC `オオオ`;
+Field Type Null Key Default Extra
+コココ char(1) YES NULL
+DESC `あああ`;
+Field Type Null Key Default Extra
+かかか char(1) YES NULL
+DESC `いいい`;
+Field Type Null Key Default Extra
+ききき char(1) YES NULL
+DESC `ううう`;
+Field Type Null Key Default Extra
+くくく char(1) YES NULL
+DESC `えええ`;
+Field Type Null Key Default Extra
+けけけ char(1) YES NULL
+DESC `おおお`;
+Field Type Null Key Default Extra
+こここ char(1) YES NULL
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丂丂丂 char(1) YES NULL
+DESC `龗龗龗`;
+Field Type Null Key Default Extra
+丄丄丄 char(1) YES NULL
+DESC `龞龞龞`;
+Field Type Null Key Default Extra
+丅丅丅 char(1) YES NULL
+DESC `龡龡龡`;
+Field Type Null Key Default Extra
+丌丌丌 char(1) YES NULL
+DESC `龢龢龢`;
+Field Type Null Key Default Extra
+丒丒丒 char(1) YES NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `カカカ` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `イイイ`;
+Table Create Table
+イイイ CREATE TABLE `イイイ` (
+ `キキキ` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `ウウウ`;
+Table Create Table
+ウウウ CREATE TABLE `ウウウ` (
+ `ククク` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `エエエ`;
+Table Create Table
+エエエ CREATE TEMPORARY TABLE `エエエ` (
+ `ケケケ` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `オオオ`;
+Table Create Table
+オオオ CREATE TEMPORARY TABLE `オオオ` (
+ `コココ` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `かかか` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `いいい`;
+Table Create Table
+いいい CREATE TABLE `いいい` (
+ `ききき` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `ううう`;
+Table Create Table
+ううう CREATE TABLE `ううう` (
+ `くくく` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `えええ`;
+Table Create Table
+えええ CREATE TEMPORARY TABLE `えええ` (
+ `けけけ` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `おおお`;
+Table Create Table
+おおお CREATE TEMPORARY TABLE `おおお` (
+ `こここ` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丂丂丂` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龗龗龗`;
+Table Create Table
+龗龗龗 CREATE TABLE `龗龗龗` (
+ `丄丄丄` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龞龞龞`;
+Table Create Table
+龞龞龞 CREATE TABLE `龞龞龞` (
+ `丅丅丅` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龡龡龡`;
+Table Create Table
+龡龡龡 CREATE TEMPORARY TABLE `龡龡龡` (
+ `丌丌丌` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龢龢龢`;
+Table Create Table
+龢龢龢 CREATE TEMPORARY TABLE `龢龢龢` (
+ `丒丒丒` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `ウウウ`;
+DROP TABLE `エエエ`;
+DROP TABLE `オオオ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `ううう`;
+DROP TABLE `えええ`;
+DROP TABLE `おおお`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+DROP TABLE `龞龞龞`;
+DROP TABLE `龡龡龡`;
+DROP TABLE `龢龢龢`;
+CREATE TABLE `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+Warnings:
+Note 1050 Table 'アアア' already exists
+CREATE TABLE IF NOT EXISTS `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+Warnings:
+Note 1050 Table 'イイイ' already exists
+CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+Warnings:
+Note 1050 Table 'あああ' already exists
+CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+Warnings:
+Note 1050 Table 'いいい' already exists
+CREATE TABLE IF NOT EXISTS `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+Warnings:
+Note 1050 Table '龖龖龖' already exists
+CREATE TABLE IF NOT EXISTS `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+Warnings:
+Note 1050 Table '龗龗龗' already exists
+CREATE TABLE IF NOT EXISTS `ウウウ`(`ククク` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `龞龞龞`(`丅丅丅`char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `エエエ`(`ケケケ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `オオオ`(`コココ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `えええ`(`けけけ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `おおお`(`こここ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `龡龡龡`(`丌丌丌` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `龢龢龢`(`丒丒丒` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+DESC `アアア`;
+Field Type Null Key Default Extra
+カカカ char(1) YES NULL
+DESC `イイイ`;
+Field Type Null Key Default Extra
+キキキ char(1) YES NULL
+DESC `ウウウ`;
+Field Type Null Key Default Extra
+ククク char(1) YES NULL
+DESC `エエエ`;
+Field Type Null Key Default Extra
+ケケケ char(1) YES NULL
+DESC `オオオ`;
+Field Type Null Key Default Extra
+コココ char(1) YES NULL
+DESC `あああ`;
+Field Type Null Key Default Extra
+かかか char(1) YES NULL
+DESC `いいい`;
+Field Type Null Key Default Extra
+ききき char(1) YES NULL
+DESC `ううう`;
+Field Type Null Key Default Extra
+くくく char(1) YES NULL
+DESC `えええ`;
+Field Type Null Key Default Extra
+けけけ char(1) YES NULL
+DESC `おおお`;
+Field Type Null Key Default Extra
+こここ char(1) YES NULL
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丂丂丂 char(1) YES NULL
+DESC `龗龗龗`;
+Field Type Null Key Default Extra
+丄丄丄 char(1) YES NULL
+DESC `龞龞龞`;
+Field Type Null Key Default Extra
+丅丅丅 char(1) YES NULL
+DESC `龡龡龡`;
+Field Type Null Key Default Extra
+丌丌丌 char(1) YES NULL
+DESC `龢龢龢`;
+Field Type Null Key Default Extra
+丒丒丒 char(1) YES NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `カカカ` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `イイイ`;
+Table Create Table
+イイイ CREATE TABLE `イイイ` (
+ `キキキ` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `ウウウ`;
+Table Create Table
+ウウウ CREATE TABLE `ウウウ` (
+ `ククク` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `エエエ`;
+Table Create Table
+エエエ CREATE TEMPORARY TABLE `エエエ` (
+ `ケケケ` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `オオオ`;
+Table Create Table
+オオオ CREATE TEMPORARY TABLE `オオオ` (
+ `コココ` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `かかか` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `いいい`;
+Table Create Table
+いいい CREATE TABLE `いいい` (
+ `ききき` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `ううう`;
+Table Create Table
+ううう CREATE TABLE `ううう` (
+ `くくく` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `えええ`;
+Table Create Table
+えええ CREATE TEMPORARY TABLE `えええ` (
+ `けけけ` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `おおお`;
+Table Create Table
+おおお CREATE TEMPORARY TABLE `おおお` (
+ `こここ` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丂丂丂` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龗龗龗`;
+Table Create Table
+龗龗龗 CREATE TABLE `龗龗龗` (
+ `丄丄丄` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龞龞龞`;
+Table Create Table
+龞龞龞 CREATE TABLE `龞龞龞` (
+ `丅丅丅` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龡龡龡`;
+Table Create Table
+龡龡龡 CREATE TEMPORARY TABLE `龡龡龡` (
+ `丌丌丌` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龢龢龢`;
+Table Create Table
+龢龢龢 CREATE TEMPORARY TABLE `龢龢龢` (
+ `丒丒丒` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `ウウウ`;
+DROP TABLE `エエエ`;
+DROP TABLE `オオオ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `ううう`;
+DROP TABLE `えええ`;
+DROP TABLE `おおお`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+DROP TABLE `龞龞龞`;
+DROP TABLE `龡龡龡`;
+DROP TABLE `龢龢龢`;
+CREATE TABLE `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+Warnings:
+Note 1050 Table 'アアア' already exists
+CREATE TABLE IF NOT EXISTS `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+Warnings:
+Note 1050 Table 'イイイ' already exists
+CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+Warnings:
+Note 1050 Table 'あああ' already exists
+CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+Warnings:
+Note 1050 Table 'いいい' already exists
+CREATE TABLE IF NOT EXISTS `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+Warnings:
+Note 1050 Table '龖龖龖' already exists
+CREATE TABLE IF NOT EXISTS `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+Warnings:
+Note 1050 Table '龗龗龗' already exists
+CREATE TABLE IF NOT EXISTS `ウウウ`(`ククク` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `龞龞龞`(`丅丅丅`char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `エエエ`(`ケケケ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `オオオ`(`コココ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `えええ`(`けけけ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `おおお`(`こここ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `龡龡龡`(`丌丌丌` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `龢龢龢`(`丒丒丒` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+DESC `アアア`;
+Field Type Null Key Default Extra
+カカカ char(1) YES NULL
+DESC `イイイ`;
+Field Type Null Key Default Extra
+キキキ char(1) YES NULL
+DESC `ウウウ`;
+Field Type Null Key Default Extra
+ククク char(1) YES NULL
+DESC `エエエ`;
+Field Type Null Key Default Extra
+ケケケ char(1) YES NULL
+DESC `オオオ`;
+Field Type Null Key Default Extra
+コココ char(1) YES NULL
+DESC `あああ`;
+Field Type Null Key Default Extra
+かかか char(1) YES NULL
+DESC `いいい`;
+Field Type Null Key Default Extra
+ききき char(1) YES NULL
+DESC `ううう`;
+Field Type Null Key Default Extra
+くくく char(1) YES NULL
+DESC `えええ`;
+Field Type Null Key Default Extra
+けけけ char(1) YES NULL
+DESC `おおお`;
+Field Type Null Key Default Extra
+こここ char(1) YES NULL
+DESC `龖龖龖`;
+Field Type Null Key Default Extra
+丂丂丂 char(1) YES NULL
+DESC `龗龗龗`;
+Field Type Null Key Default Extra
+丄丄丄 char(1) YES NULL
+DESC `龞龞龞`;
+Field Type Null Key Default Extra
+丅丅丅 char(1) YES NULL
+DESC `龡龡龡`;
+Field Type Null Key Default Extra
+丌丌丌 char(1) YES NULL
+DESC `龢龢龢`;
+Field Type Null Key Default Extra
+丒丒丒 char(1) YES NULL
+SHOW CREATE TABLE `アアア`;
+Table Create Table
+アアア CREATE TABLE `アアア` (
+ `カカカ` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `イイイ`;
+Table Create Table
+イイイ CREATE TABLE `イイイ` (
+ `キキキ` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `ウウウ`;
+Table Create Table
+ウウウ CREATE TABLE `ウウウ` (
+ `ククク` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `エエエ`;
+Table Create Table
+エエエ CREATE TEMPORARY TABLE `エエエ` (
+ `ケケケ` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `オオオ`;
+Table Create Table
+オオオ CREATE TEMPORARY TABLE `オオオ` (
+ `コココ` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `あああ`;
+Table Create Table
+あああ CREATE TABLE `あああ` (
+ `かかか` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `いいい`;
+Table Create Table
+いいい CREATE TABLE `いいい` (
+ `ききき` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `ううう`;
+Table Create Table
+ううう CREATE TABLE `ううう` (
+ `くくく` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `えええ`;
+Table Create Table
+えええ CREATE TEMPORARY TABLE `えええ` (
+ `けけけ` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `おおお`;
+Table Create Table
+おおお CREATE TEMPORARY TABLE `おおお` (
+ `こここ` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龖龖龖`;
+Table Create Table
+龖龖龖 CREATE TABLE `龖龖龖` (
+ `丂丂丂` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龗龗龗`;
+Table Create Table
+龗龗龗 CREATE TABLE `龗龗龗` (
+ `丄丄丄` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龞龞龞`;
+Table Create Table
+龞龞龞 CREATE TABLE `龞龞龞` (
+ `丅丅丅` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龡龡龡`;
+Table Create Table
+龡龡龡 CREATE TEMPORARY TABLE `龡龡龡` (
+ `丌丌丌` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `龢龢龢`;
+Table Create Table
+龢龢龢 CREATE TEMPORARY TABLE `龢龢龢` (
+ `丒丒丒` char(1) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `ウウウ`;
+DROP TABLE `エエエ`;
+DROP TABLE `オオオ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `ううう`;
+DROP TABLE `えええ`;
+DROP TABLE `おおお`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+DROP TABLE `龞龞龞`;
+DROP TABLE `龡龡龡`;
+DROP TABLE `龢龢龢`;
diff --git a/mysql-test/suite/jp/r/jp_enum_sjis.result b/mysql-test/suite/jp/r/jp_enum_sjis.result
new file mode 100644
index 00000000..0ea3f751
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_enum_sjis.result
@@ -0,0 +1,279 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+drop table if exists t1;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` ENUM('\','\','\'), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` ENUM('\','\','\'), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` ENUM('\','\','\'), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),('');
+INSERT INTO `sR` VALUES ('\'),('\'),('\');
+INSERT INTO `sS` VALUES (''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),('');
+INSERT INTO `sU` VALUES ('\'),('\'),('\');
+INSERT INTO `sV` VALUES (''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),('');
+INSERT INTO `sX` VALUES ('\'),('\'),('\');
+SELECT * FROM `sP`;
+bP
+
+
+
+SELECT * FROM `sQ`;
+bP
+
+
+
+SELECT * FROM `sR`;
+bP
+\
+\
+\
+SELECT * FROM `sS`;
+bP
+
+
+
+SELECT * FROM `sT`;
+bP
+
+
+
+SELECT * FROM `sU`;
+bP
+\
+\
+\
+SELECT * FROM `sV`;
+bP
+
+
+
+SELECT * FROM `sW`;
+bP
+
+
+
+SELECT * FROM `sX`;
+bP
+\
+\
+\
+SHOW CREATE TABLE `sP`;
+Table Create Table
+sP CREATE TABLE `sP` (
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sQ`;
+Table Create Table
+sQ CREATE TABLE `sQ` (
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sR`;
+Table Create Table
+sR CREATE TABLE `sR` (
+ `bP` enum('\','\','\') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sS`;
+Table Create Table
+sS CREATE TABLE `sS` (
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sT`;
+Table Create Table
+sT CREATE TABLE `sT` (
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sU`;
+Table Create Table
+sU CREATE TABLE `sU` (
+ `bP` enum('\','\','\') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sV`;
+Table Create Table
+sV CREATE TABLE `sV` (
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sW`;
+Table Create Table
+sW CREATE TABLE `sW` (
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sX`;
+Table Create Table
+sX CREATE TABLE `sX` (
+ `bP` enum('\','\','\') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+DESC `sP`;
+Field Type Null Key Default Extra
+bP enum('','','') YES MUL NULL
+DESC `sQ`;
+Field Type Null Key Default Extra
+bP enum('','','') YES MUL NULL
+DESC `sR`;
+Field Type Null Key Default Extra
+bP enum('\','\','\') YES MUL NULL
+DESC `sS`;
+Field Type Null Key Default Extra
+bP enum('','','') YES MUL NULL
+DESC `sT`;
+Field Type Null Key Default Extra
+bP enum('','','') YES MUL NULL
+DESC `sU`;
+Field Type Null Key Default Extra
+bP enum('\','\','\') YES MUL NULL
+DESC `sV`;
+Field Type Null Key Default Extra
+bP enum('','','') YES MUL NULL
+DESC `sW`;
+Field Type Null Key Default Extra
+bP enum('','','') YES MUL NULL
+DESC `sX`;
+Field Type Null Key Default Extra
+bP enum('\','\','\') YES MUL NULL
+ALTER TABLE `sP` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sQ` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sR` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sS` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sT` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sU` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sV` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sW` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sX` ADD `bQ` CHAR(1) NOT NULL FIRST;
+SHOW CREATE TABLE `sP`;
+Table Create Table
+sP CREATE TABLE `sP` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sQ`;
+Table Create Table
+sQ CREATE TABLE `sQ` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sR`;
+Table Create Table
+sR CREATE TABLE `sR` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('\','\','\') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=InnoDB DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sS`;
+Table Create Table
+sS CREATE TABLE `sS` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sT`;
+Table Create Table
+sT CREATE TABLE `sT` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sU`;
+Table Create Table
+sU CREATE TABLE `sU` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('\','\','\') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sV`;
+Table Create Table
+sV CREATE TABLE `sV` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sW`;
+Table Create Table
+sW CREATE TABLE `sW` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('','','') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+SHOW CREATE TABLE `sX`;
+Table Create Table
+sX CREATE TABLE `sX` (
+ `bQ` char(1) NOT NULL,
+ `bP` enum('\','\','\') DEFAULT NULL,
+ KEY `bP` (`bP`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_ci
+CREATE TABLE t1(c1 enum('S','s')) default character set = sjis;
+INSERT INTO t1 VALUES('S'),('s');
+SELECT * FROM t1 WHERE c1 LIKE 'S';
+c1
+S
+DROP TABLE t1;
+DESC `sP`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('','','') YES MUL NULL
+DESC `sQ`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('','','') YES MUL NULL
+DESC `sR`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('\','\','\') YES MUL NULL
+DESC `sS`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('','','') YES MUL NULL
+DESC `sT`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('','','') YES MUL NULL
+DESC `sU`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('\','\','\') YES MUL NULL
+DESC `sV`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('','','') YES MUL NULL
+DESC `sW`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('','','') YES MUL NULL
+DESC `sX`;
+Field Type Null Key Default Extra
+bQ char(1) NO NULL
+bP enum('\','\','\') YES MUL NULL
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_enum_ucs2.result b/mysql-test/suite/jp/r/jp_enum_ucs2.result
new file mode 100644
index 00000000..683c0458
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_enum_ucs2.result
@@ -0,0 +1,273 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_enum_ujis.result b/mysql-test/suite/jp/r/jp_enum_ujis.result
new file mode 100644
index 00000000..8221c1c8
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_enum_ujis.result
@@ -0,0 +1,272 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SELECT * FROM `ԣ`;
+
+
+
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã enum('','','') YES MUL NULL
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=InnoDB DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+SHOW CREATE TABLE `ԣ`;
+Table Create Table
+ԣ CREATE TABLE `ԣ` (
+ `ã` char(1) NOT NULL,
+ `ã` enum('','','') DEFAULT NULL,
+ KEY `ã` (`ã`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_ci
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DESC `ԣ`;
+Field Type Null Key Default Extra
+ã char(1) NO NULL
+ã enum('','','') YES MUL NULL
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_enum_utf8.result b/mysql-test/suite/jp/r/jp_enum_utf8.result
new file mode 100644
index 00000000..c6e3567e
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_enum_utf8.result
@@ -0,0 +1,272 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` ENUM('ア','イ','ウ'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` ENUM('あ','い','う'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` ENUM('龔','龖','龗'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` ENUM('ア','イ','ウ'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` ENUM('あ','い','う'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` ENUM('龔','龖','龗'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` ENUM('ア','イ','ウ'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` ENUM('あ','い','う'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` ENUM('龔','龖','龗'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('ア'),('イ'),('ウ');
+INSERT INTO `T2` VALUES ('あ'),('い'),('う');
+INSERT INTO `T3` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T4` VALUES ('ア'),('イ'),('ウ');
+INSERT INTO `T5` VALUES ('あ'),('い'),('う');
+INSERT INTO `T6` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T7` VALUES ('ア'),('イ'),('ウ');
+INSERT INTO `T8` VALUES ('あ'),('い'),('う');
+INSERT INTO `T9` VALUES ('龔'),('龖'),('龗');
+SELECT * FROM `T1`;
+C1
+ア
+イ
+ウ
+SELECT * FROM `T2`;
+C1
+あ
+い
+う
+SELECT * FROM `T3`;
+C1
+龔
+龖
+龗
+SELECT * FROM `T4`;
+C1
+ア
+イ
+ウ
+SELECT * FROM `T5`;
+C1
+あ
+い
+う
+SELECT * FROM `T6`;
+C1
+龔
+龖
+龗
+SELECT * FROM `T7`;
+C1
+ア
+イ
+ウ
+SELECT * FROM `T8`;
+C1
+あ
+い
+う
+SELECT * FROM `T9`;
+C1
+龔
+龖
+龗
+SHOW CREATE TABLE `T1`;
+Table Create Table
+T1 CREATE TABLE `T1` (
+ `C1` enum('ア','イ','ウ') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T2`;
+Table Create Table
+T2 CREATE TABLE `T2` (
+ `C1` enum('あ','い','う') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T3`;
+Table Create Table
+T3 CREATE TABLE `T3` (
+ `C1` enum('龔','龖','龗') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T4`;
+Table Create Table
+T4 CREATE TABLE `T4` (
+ `C1` enum('ア','イ','ウ') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T5`;
+Table Create Table
+T5 CREATE TABLE `T5` (
+ `C1` enum('あ','い','う') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T6`;
+Table Create Table
+T6 CREATE TABLE `T6` (
+ `C1` enum('龔','龖','龗') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T7`;
+Table Create Table
+T7 CREATE TABLE `T7` (
+ `C1` enum('ア','イ','ウ') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T8`;
+Table Create Table
+T8 CREATE TABLE `T8` (
+ `C1` enum('あ','い','う') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T9`;
+Table Create Table
+T9 CREATE TABLE `T9` (
+ `C1` enum('龔','龖','龗') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DESC `T1`;
+Field Type Null Key Default Extra
+C1 enum('ア','イ','ウ') YES MUL NULL
+DESC `T2`;
+Field Type Null Key Default Extra
+C1 enum('あ','い','う') YES MUL NULL
+DESC `T3`;
+Field Type Null Key Default Extra
+C1 enum('龔','龖','龗') YES MUL NULL
+DESC `T4`;
+Field Type Null Key Default Extra
+C1 enum('ア','イ','ウ') YES MUL NULL
+DESC `T5`;
+Field Type Null Key Default Extra
+C1 enum('あ','い','う') YES MUL NULL
+DESC `T6`;
+Field Type Null Key Default Extra
+C1 enum('龔','龖','龗') YES MUL NULL
+DESC `T7`;
+Field Type Null Key Default Extra
+C1 enum('ア','イ','ウ') YES MUL NULL
+DESC `T8`;
+Field Type Null Key Default Extra
+C1 enum('あ','い','う') YES MUL NULL
+DESC `T9`;
+Field Type Null Key Default Extra
+C1 enum('龔','龖','龗') YES MUL NULL
+ALTER TABLE `T1` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T2` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T3` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T4` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T5` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T6` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T7` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T8` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T9` ADD `C2` CHAR(1) NOT NULL FIRST;
+SHOW CREATE TABLE `T1`;
+Table Create Table
+T1 CREATE TABLE `T1` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('ア','イ','ウ') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T2`;
+Table Create Table
+T2 CREATE TABLE `T2` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('あ','い','う') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T3`;
+Table Create Table
+T3 CREATE TABLE `T3` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('龔','龖','龗') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T4`;
+Table Create Table
+T4 CREATE TABLE `T4` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('ア','イ','ウ') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T5`;
+Table Create Table
+T5 CREATE TABLE `T5` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('あ','い','う') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T6`;
+Table Create Table
+T6 CREATE TABLE `T6` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('龔','龖','龗') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T7`;
+Table Create Table
+T7 CREATE TABLE `T7` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('ア','イ','ウ') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T8`;
+Table Create Table
+T8 CREATE TABLE `T8` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('あ','い','う') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+SHOW CREATE TABLE `T9`;
+Table Create Table
+T9 CREATE TABLE `T9` (
+ `C2` char(1) NOT NULL,
+ `C1` enum('龔','龖','龗') DEFAULT NULL,
+ KEY `C1` (`C1`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DESC `T1`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('ア','イ','ウ') YES MUL NULL
+DESC `T2`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('あ','い','う') YES MUL NULL
+DESC `T3`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('龔','龖','龗') YES MUL NULL
+DESC `T4`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('ア','イ','ウ') YES MUL NULL
+DESC `T5`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('あ','い','う') YES MUL NULL
+DESC `T6`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('龔','龖','龗') YES MUL NULL
+DESC `T7`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('ア','イ','ウ') YES MUL NULL
+DESC `T8`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('あ','い','う') YES MUL NULL
+DESC `T9`;
+Field Type Null Key Default Extra
+C2 char(1) NO NULL
+C1 enum('龔','龖','龗') YES MUL NULL
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_insert_sjis.result b/mysql-test/suite/jp/r/jp_insert_sjis.result
new file mode 100644
index 00000000..53b1cdc6
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_insert_sjis.result
@@ -0,0 +1,713 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+SELECT INSERT(`bP`,1,1,'') FROM `sP`;
+INSERT(`bP`,1,1,'')
+
+SELECT INSERT(`bP`,1,2,'') FROM `sP`;
+INSERT(`bP`,1,2,'')
+
+SELECT INSERT(`bP`,1,3,'') FROM `sP`;
+INSERT(`bP`,1,3,'')
+
+SELECT INSERT(`bP`,1,4,'') FROM `sP`;
+INSERT(`bP`,1,4,'')
+
+SELECT INSERT(`bP`,1,5,'') FROM `sP`;
+INSERT(`bP`,1,5,'')
+
+SELECT INSERT(`bP`,2,1,'') FROM `sP`;
+INSERT(`bP`,2,1,'')
+
+SELECT INSERT(`bP`,2,2,'') FROM `sP`;
+INSERT(`bP`,2,2,'')
+
+SELECT INSERT(`bP`,2,3,'') FROM `sP`;
+INSERT(`bP`,2,3,'')
+
+SELECT INSERT(`bP`,2,4,'') FROM `sP`;
+INSERT(`bP`,2,4,'')
+
+SELECT INSERT(`bP`,3,1,'') FROM `sP`;
+INSERT(`bP`,3,1,'')
+
+SELECT INSERT(`bP`,3,2,'') FROM `sP`;
+INSERT(`bP`,3,2,'')
+
+SELECT INSERT(`bP`,3,3,'') FROM `sP`;
+INSERT(`bP`,3,3,'')
+
+SELECT INSERT(`bP`,4,1,'') FROM `sP`;
+INSERT(`bP`,4,1,'')
+
+SELECT INSERT(`bP`,4,2,'') FROM `sP`;
+INSERT(`bP`,4,2,'')
+
+SELECT INSERT(`bP`,5,1,'') FROM `sP`;
+INSERT(`bP`,5,1,'')
+
+SELECT INSERT(`bP`,1,1,' ') FROM `sP`;
+INSERT(`bP`,1,1,' ')
+
+SELECT INSERT(`bP`,1,2,' ') FROM `sP`;
+INSERT(`bP`,1,2,' ')
+
+SELECT INSERT(`bP`,1,3,' ') FROM `sP`;
+INSERT(`bP`,1,3,' ')
+
+SELECT INSERT(`bP`,1,4,' ') FROM `sP`;
+INSERT(`bP`,1,4,' ')
+
+SELECT INSERT(`bP`,1,5,' ') FROM `sP`;
+INSERT(`bP`,1,5,' ')
+
+SELECT INSERT(`bP`,2,1,' ') FROM `sP`;
+INSERT(`bP`,2,1,' ')
+
+SELECT INSERT(`bP`,2,2,' ') FROM `sP`;
+INSERT(`bP`,2,2,' ')
+
+SELECT INSERT(`bP`,2,3,' ') FROM `sP`;
+INSERT(`bP`,2,3,' ')
+
+SELECT INSERT(`bP`,2,4,' ') FROM `sP`;
+INSERT(`bP`,2,4,' ')
+
+SELECT INSERT(`bP`,3,1,' ') FROM `sP`;
+INSERT(`bP`,3,1,' ')
+
+SELECT INSERT(`bP`,3,2,' ') FROM `sP`;
+INSERT(`bP`,3,2,' ')
+
+SELECT INSERT(`bP`,3,3,' ') FROM `sP`;
+INSERT(`bP`,3,3,' ')
+
+SELECT INSERT(`bP`,4,1,' ') FROM `sP`;
+INSERT(`bP`,4,1,' ')
+
+SELECT INSERT(`bP`,4,2,' ') FROM `sP`;
+INSERT(`bP`,4,2,' ')
+
+SELECT INSERT(`bP`,5,1,' ') FROM `sP`;
+INSERT(`bP`,5,1,' ')
+
+SELECT INSERT(`bP`,1,1,'') FROM `sQ`;
+INSERT(`bP`,1,1,'')
+
+SELECT INSERT(`bP`,1,2,'') FROM `sQ`;
+INSERT(`bP`,1,2,'')
+
+SELECT INSERT(`bP`,1,3,'') FROM `sQ`;
+INSERT(`bP`,1,3,'')
+
+SELECT INSERT(`bP`,1,4,'') FROM `sQ`;
+INSERT(`bP`,1,4,'')
+
+SELECT INSERT(`bP`,1,5,'') FROM `sQ`;
+INSERT(`bP`,1,5,'')
+
+SELECT INSERT(`bP`,2,1,'') FROM `sQ`;
+INSERT(`bP`,2,1,'')
+
+SELECT INSERT(`bP`,2,2,'') FROM `sQ`;
+INSERT(`bP`,2,2,'')
+
+SELECT INSERT(`bP`,2,3,'') FROM `sQ`;
+INSERT(`bP`,2,3,'')
+
+SELECT INSERT(`bP`,2,4,'') FROM `sQ`;
+INSERT(`bP`,2,4,'')
+
+SELECT INSERT(`bP`,3,1,'') FROM `sQ`;
+INSERT(`bP`,3,1,'')
+
+SELECT INSERT(`bP`,3,2,'') FROM `sQ`;
+INSERT(`bP`,3,2,'')
+
+SELECT INSERT(`bP`,3,3,'') FROM `sQ`;
+INSERT(`bP`,3,3,'')
+
+SELECT INSERT(`bP`,4,1,'') FROM `sQ`;
+INSERT(`bP`,4,1,'')
+
+SELECT INSERT(`bP`,4,2,'') FROM `sQ`;
+INSERT(`bP`,4,2,'')
+
+SELECT INSERT(`bP`,5,1,'') FROM `sQ`;
+INSERT(`bP`,5,1,'')
+
+SELECT INSERT(`bP`,1,1,'@') FROM `sQ`;
+INSERT(`bP`,1,1,'@')
+@
+SELECT INSERT(`bP`,1,2,'@@') FROM `sQ`;
+INSERT(`bP`,1,2,'@@')
+@@
+SELECT INSERT(`bP`,1,3,'@@@') FROM `sQ`;
+INSERT(`bP`,1,3,'@@@')
+@@@
+SELECT INSERT(`bP`,1,4,'@@@@') FROM `sQ`;
+INSERT(`bP`,1,4,'@@@@')
+@@@@
+SELECT INSERT(`bP`,1,5,'@@@@@') FROM `sQ`;
+INSERT(`bP`,1,5,'@@@@@')
+@@@@@
+SELECT INSERT(`bP`,2,1,'@') FROM `sQ`;
+INSERT(`bP`,2,1,'@')
+@
+SELECT INSERT(`bP`,2,2,'@@') FROM `sQ`;
+INSERT(`bP`,2,2,'@@')
+@@
+SELECT INSERT(`bP`,2,3,'@@@') FROM `sQ`;
+INSERT(`bP`,2,3,'@@@')
+@@@
+SELECT INSERT(`bP`,2,4,'@@@@') FROM `sQ`;
+INSERT(`bP`,2,4,'@@@@')
+@@@@
+SELECT INSERT(`bP`,3,1,'@') FROM `sQ`;
+INSERT(`bP`,3,1,'@')
+@
+SELECT INSERT(`bP`,3,2,'@@') FROM `sQ`;
+INSERT(`bP`,3,2,'@@')
+@@
+SELECT INSERT(`bP`,3,3,'@@@') FROM `sQ`;
+INSERT(`bP`,3,3,'@@@')
+@@@
+SELECT INSERT(`bP`,4,1,'@') FROM `sQ`;
+INSERT(`bP`,4,1,'@')
+@
+SELECT INSERT(`bP`,4,2,'@@') FROM `sQ`;
+INSERT(`bP`,4,2,'@@')
+@@
+SELECT INSERT(`bP`,5,1,'@') FROM `sQ`;
+INSERT(`bP`,5,1,'@')
+@
+SELECT INSERT(`bP`,1,1,'\') FROM `sR`;
+INSERT(`bP`,1,1,'\')
+\\\\\
+SELECT INSERT(`bP`,1,2,'\\' ) FROM `sR`;
+INSERT(`bP`,1,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,1,3,'\\\' ) FROM `sR`;
+INSERT(`bP`,1,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,1,4,'\\\\' ) FROM `sR`;
+INSERT(`bP`,1,4,'\\\\' )
+\\\\\
+SELECT INSERT(`bP`,1,5,'\\\\\' ) FROM `sR`;
+INSERT(`bP`,1,5,'\\\\\' )
+\\\\\
+SELECT INSERT(`bP`,2,1,'\') FROM `sR`;
+INSERT(`bP`,2,1,'\')
+\\\\\
+SELECT INSERT(`bP`,2,2,'\\' ) FROM `sR`;
+INSERT(`bP`,2,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,2,3,'\\\' ) FROM `sR`;
+INSERT(`bP`,2,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,2,4,'\\\\' ) FROM `sR`;
+INSERT(`bP`,2,4,'\\\\' )
+\\\\\
+SELECT INSERT(`bP`,3,1,'\') FROM `sR`;
+INSERT(`bP`,3,1,'\')
+\\\\\
+SELECT INSERT(`bP`,3,2,'\\' ) FROM `sR`;
+INSERT(`bP`,3,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,3,3,'\\\' ) FROM `sR`;
+INSERT(`bP`,3,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,4,1,'\') FROM `sR`;
+INSERT(`bP`,4,1,'\')
+\\\\\
+SELECT INSERT(`bP`,4,2,'\\' ) FROM `sR`;
+INSERT(`bP`,4,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,5,1,'\') FROM `sR`;
+INSERT(`bP`,5,1,'\')
+\\\\\
+SELECT INSERT(`bP`,1,1,'') FROM `sS`;
+INSERT(`bP`,1,1,'')
+
+SELECT INSERT(`bP`,1,2,'') FROM `sS`;
+INSERT(`bP`,1,2,'')
+
+SELECT INSERT(`bP`,1,3,'') FROM `sS`;
+INSERT(`bP`,1,3,'')
+
+SELECT INSERT(`bP`,1,4,'') FROM `sS`;
+INSERT(`bP`,1,4,'')
+
+SELECT INSERT(`bP`,1,5,'') FROM `sS`;
+INSERT(`bP`,1,5,'')
+
+SELECT INSERT(`bP`,2,1,'') FROM `sS`;
+INSERT(`bP`,2,1,'')
+
+SELECT INSERT(`bP`,2,2,'') FROM `sS`;
+INSERT(`bP`,2,2,'')
+
+SELECT INSERT(`bP`,2,3,'') FROM `sS`;
+INSERT(`bP`,2,3,'')
+
+SELECT INSERT(`bP`,2,4,'') FROM `sS`;
+INSERT(`bP`,2,4,'')
+
+SELECT INSERT(`bP`,3,1,'') FROM `sS`;
+INSERT(`bP`,3,1,'')
+
+SELECT INSERT(`bP`,3,2,'') FROM `sS`;
+INSERT(`bP`,3,2,'')
+
+SELECT INSERT(`bP`,3,3,'') FROM `sS`;
+INSERT(`bP`,3,3,'')
+
+SELECT INSERT(`bP`,4,1,'') FROM `sS`;
+INSERT(`bP`,4,1,'')
+
+SELECT INSERT(`bP`,4,2,'') FROM `sS`;
+INSERT(`bP`,4,2,'')
+
+SELECT INSERT(`bP`,5,1,'') FROM `sS`;
+INSERT(`bP`,5,1,'')
+
+SELECT INSERT(`bP`,1,1,' ') FROM `sS`;
+INSERT(`bP`,1,1,' ')
+
+SELECT INSERT(`bP`,1,2,' ') FROM `sS`;
+INSERT(`bP`,1,2,' ')
+
+SELECT INSERT(`bP`,1,3,' ') FROM `sS`;
+INSERT(`bP`,1,3,' ')
+
+SELECT INSERT(`bP`,1,4,' ') FROM `sS`;
+INSERT(`bP`,1,4,' ')
+
+SELECT INSERT(`bP`,1,5,' ') FROM `sS`;
+INSERT(`bP`,1,5,' ')
+
+SELECT INSERT(`bP`,2,1,' ') FROM `sS`;
+INSERT(`bP`,2,1,' ')
+
+SELECT INSERT(`bP`,2,2,' ') FROM `sS`;
+INSERT(`bP`,2,2,' ')
+
+SELECT INSERT(`bP`,2,3,' ') FROM `sS`;
+INSERT(`bP`,2,3,' ')
+
+SELECT INSERT(`bP`,2,4,' ') FROM `sS`;
+INSERT(`bP`,2,4,' ')
+
+SELECT INSERT(`bP`,3,1,' ') FROM `sS`;
+INSERT(`bP`,3,1,' ')
+
+SELECT INSERT(`bP`,3,2,' ') FROM `sS`;
+INSERT(`bP`,3,2,' ')
+
+SELECT INSERT(`bP`,3,3,' ') FROM `sS`;
+INSERT(`bP`,3,3,' ')
+
+SELECT INSERT(`bP`,4,1,' ') FROM `sS`;
+INSERT(`bP`,4,1,' ')
+
+SELECT INSERT(`bP`,4,2,' ') FROM `sS`;
+INSERT(`bP`,4,2,' ')
+
+SELECT INSERT(`bP`,5,1,' ') FROM `sS`;
+INSERT(`bP`,5,1,' ')
+
+SELECT INSERT(`bP`,1,1,'') FROM `sT`;
+INSERT(`bP`,1,1,'')
+
+SELECT INSERT(`bP`,1,2,'') FROM `sT`;
+INSERT(`bP`,1,2,'')
+
+SELECT INSERT(`bP`,1,3,'') FROM `sT`;
+INSERT(`bP`,1,3,'')
+
+SELECT INSERT(`bP`,1,4,'') FROM `sT`;
+INSERT(`bP`,1,4,'')
+
+SELECT INSERT(`bP`,1,5,'') FROM `sT`;
+INSERT(`bP`,1,5,'')
+
+SELECT INSERT(`bP`,2,1,'') FROM `sT`;
+INSERT(`bP`,2,1,'')
+
+SELECT INSERT(`bP`,2,2,'') FROM `sT`;
+INSERT(`bP`,2,2,'')
+
+SELECT INSERT(`bP`,2,3,'') FROM `sT`;
+INSERT(`bP`,2,3,'')
+
+SELECT INSERT(`bP`,2,4,'') FROM `sT`;
+INSERT(`bP`,2,4,'')
+
+SELECT INSERT(`bP`,3,1,'') FROM `sT`;
+INSERT(`bP`,3,1,'')
+
+SELECT INSERT(`bP`,3,2,'') FROM `sT`;
+INSERT(`bP`,3,2,'')
+
+SELECT INSERT(`bP`,3,3,'') FROM `sT`;
+INSERT(`bP`,3,3,'')
+
+SELECT INSERT(`bP`,4,1,'') FROM `sT`;
+INSERT(`bP`,4,1,'')
+
+SELECT INSERT(`bP`,4,2,'') FROM `sT`;
+INSERT(`bP`,4,2,'')
+
+SELECT INSERT(`bP`,5,1,'') FROM `sT`;
+INSERT(`bP`,5,1,'')
+
+SELECT INSERT(`bP`,1,1,'@') FROM `sT`;
+INSERT(`bP`,1,1,'@')
+@
+SELECT INSERT(`bP`,1,2,'@@') FROM `sT`;
+INSERT(`bP`,1,2,'@@')
+@@
+SELECT INSERT(`bP`,1,3,'@@@') FROM `sT`;
+INSERT(`bP`,1,3,'@@@')
+@@@
+SELECT INSERT(`bP`,1,4,'@@@@') FROM `sT`;
+INSERT(`bP`,1,4,'@@@@')
+@@@@
+SELECT INSERT(`bP`,1,5,'@@@@@') FROM `sT`;
+INSERT(`bP`,1,5,'@@@@@')
+@@@@@
+SELECT INSERT(`bP`,2,1,'@') FROM `sT`;
+INSERT(`bP`,2,1,'@')
+@
+SELECT INSERT(`bP`,2,2,'@@') FROM `sT`;
+INSERT(`bP`,2,2,'@@')
+@@
+SELECT INSERT(`bP`,2,3,'@@@') FROM `sT`;
+INSERT(`bP`,2,3,'@@@')
+@@@
+SELECT INSERT(`bP`,2,4,'@@@@') FROM `sT`;
+INSERT(`bP`,2,4,'@@@@')
+@@@@
+SELECT INSERT(`bP`,3,1,'@') FROM `sT`;
+INSERT(`bP`,3,1,'@')
+@
+SELECT INSERT(`bP`,3,2,'@@') FROM `sT`;
+INSERT(`bP`,3,2,'@@')
+@@
+SELECT INSERT(`bP`,3,3,'@@@') FROM `sT`;
+INSERT(`bP`,3,3,'@@@')
+@@@
+SELECT INSERT(`bP`,4,1,'@') FROM `sT`;
+INSERT(`bP`,4,1,'@')
+@
+SELECT INSERT(`bP`,4,2,'@@') FROM `sT`;
+INSERT(`bP`,4,2,'@@')
+@@
+SELECT INSERT(`bP`,5,1,'@') FROM `sT`;
+INSERT(`bP`,5,1,'@')
+@
+SELECT INSERT(`bP`,1,1,'\') FROM `sU`;
+INSERT(`bP`,1,1,'\')
+\\\\\
+SELECT INSERT(`bP`,1,2,'\\' ) FROM `sU`;
+INSERT(`bP`,1,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,1,3,'\\\' ) FROM `sU`;
+INSERT(`bP`,1,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,1,4,'\\\\' ) FROM `sU`;
+INSERT(`bP`,1,4,'\\\\' )
+\\\\\
+SELECT INSERT(`bP`,1,5,'\\\\\' ) FROM `sU`;
+INSERT(`bP`,1,5,'\\\\\' )
+\\\\\
+SELECT INSERT(`bP`,2,1,'\') FROM `sU`;
+INSERT(`bP`,2,1,'\')
+\\\\\
+SELECT INSERT(`bP`,2,2,'\\') FROM `sU`;
+INSERT(`bP`,2,2,'\\')
+\\\\\
+SELECT INSERT(`bP`,2,3,'\\\' ) FROM `sU`;
+INSERT(`bP`,2,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,2,4,'\\\\' ) FROM `sU`;
+INSERT(`bP`,2,4,'\\\\' )
+\\\\\
+SELECT INSERT(`bP`,3,1,'\') FROM `sU`;
+INSERT(`bP`,3,1,'\')
+\\\\\
+SELECT INSERT(`bP`,3,2,'\\' ) FROM `sU`;
+INSERT(`bP`,3,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,3,3,'\\\' ) FROM `sU`;
+INSERT(`bP`,3,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,4,1,'\') FROM `sU`;
+INSERT(`bP`,4,1,'\')
+\\\\\
+SELECT INSERT(`bP`,4,2,'\\' ) FROM `sU`;
+INSERT(`bP`,4,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,5,1,'\') FROM `sU`;
+INSERT(`bP`,5,1,'\')
+\\\\\
+SELECT INSERT(`bP`,1,1,'') FROM `sV`;
+INSERT(`bP`,1,1,'')
+
+SELECT INSERT(`bP`,1,2,'') FROM `sV`;
+INSERT(`bP`,1,2,'')
+
+SELECT INSERT(`bP`,1,3,'') FROM `sV`;
+INSERT(`bP`,1,3,'')
+
+SELECT INSERT(`bP`,1,4,'') FROM `sV`;
+INSERT(`bP`,1,4,'')
+
+SELECT INSERT(`bP`,1,5,'') FROM `sV`;
+INSERT(`bP`,1,5,'')
+
+SELECT INSERT(`bP`,2,1,'') FROM `sV`;
+INSERT(`bP`,2,1,'')
+
+SELECT INSERT(`bP`,2,2,'') FROM `sV`;
+INSERT(`bP`,2,2,'')
+
+SELECT INSERT(`bP`,2,3,'') FROM `sV`;
+INSERT(`bP`,2,3,'')
+
+SELECT INSERT(`bP`,2,4,'') FROM `sV`;
+INSERT(`bP`,2,4,'')
+
+SELECT INSERT(`bP`,3,1,'') FROM `sV`;
+INSERT(`bP`,3,1,'')
+
+SELECT INSERT(`bP`,3,2,'') FROM `sV`;
+INSERT(`bP`,3,2,'')
+
+SELECT INSERT(`bP`,3,3,'') FROM `sV`;
+INSERT(`bP`,3,3,'')
+
+SELECT INSERT(`bP`,4,1,'') FROM `sV`;
+INSERT(`bP`,4,1,'')
+
+SELECT INSERT(`bP`,4,2,'') FROM `sV`;
+INSERT(`bP`,4,2,'')
+
+SELECT INSERT(`bP`,5,1,'') FROM `sV`;
+INSERT(`bP`,5,1,'')
+
+SELECT INSERT(`bP`,1,1,' ') FROM `sV`;
+INSERT(`bP`,1,1,' ')
+
+SELECT INSERT(`bP`,1,2,' ') FROM `sV`;
+INSERT(`bP`,1,2,' ')
+
+SELECT INSERT(`bP`,1,3,' ') FROM `sV`;
+INSERT(`bP`,1,3,' ')
+
+SELECT INSERT(`bP`,1,4,' ') FROM `sV`;
+INSERT(`bP`,1,4,' ')
+
+SELECT INSERT(`bP`,1,5,' ') FROM `sV`;
+INSERT(`bP`,1,5,' ')
+
+SELECT INSERT(`bP`,2,1,' ') FROM `sV`;
+INSERT(`bP`,2,1,' ')
+
+SELECT INSERT(`bP`,2,2,' ') FROM `sV`;
+INSERT(`bP`,2,2,' ')
+
+SELECT INSERT(`bP`,2,3,' ') FROM `sV`;
+INSERT(`bP`,2,3,' ')
+
+SELECT INSERT(`bP`,2,4,' ') FROM `sV`;
+INSERT(`bP`,2,4,' ')
+
+SELECT INSERT(`bP`,3,1,' ') FROM `sV`;
+INSERT(`bP`,3,1,' ')
+
+SELECT INSERT(`bP`,3,2,' ') FROM `sV`;
+INSERT(`bP`,3,2,' ')
+
+SELECT INSERT(`bP`,3,3,' ') FROM `sV`;
+INSERT(`bP`,3,3,' ')
+
+SELECT INSERT(`bP`,4,1,' ') FROM `sV`;
+INSERT(`bP`,4,1,' ')
+
+SELECT INSERT(`bP`,4,2,' ') FROM `sV`;
+INSERT(`bP`,4,2,' ')
+
+SELECT INSERT(`bP`,5,1,' ') FROM `sV`;
+INSERT(`bP`,5,1,' ')
+
+SELECT INSERT(`bP`,1,1,'') FROM `sW`;
+INSERT(`bP`,1,1,'')
+
+SELECT INSERT(`bP`,1,2,'') FROM `sW`;
+INSERT(`bP`,1,2,'')
+
+SELECT INSERT(`bP`,1,3,'') FROM `sW`;
+INSERT(`bP`,1,3,'')
+
+SELECT INSERT(`bP`,1,4,'') FROM `sW`;
+INSERT(`bP`,1,4,'')
+
+SELECT INSERT(`bP`,1,5,'') FROM `sW`;
+INSERT(`bP`,1,5,'')
+
+SELECT INSERT(`bP`,2,1,'') FROM `sW`;
+INSERT(`bP`,2,1,'')
+
+SELECT INSERT(`bP`,2,2,'') FROM `sW`;
+INSERT(`bP`,2,2,'')
+
+SELECT INSERT(`bP`,2,3,'') FROM `sW`;
+INSERT(`bP`,2,3,'')
+
+SELECT INSERT(`bP`,2,4,'') FROM `sW`;
+INSERT(`bP`,2,4,'')
+
+SELECT INSERT(`bP`,3,1,'') FROM `sW`;
+INSERT(`bP`,3,1,'')
+
+SELECT INSERT(`bP`,3,2,'') FROM `sW`;
+INSERT(`bP`,3,2,'')
+
+SELECT INSERT(`bP`,3,3,'') FROM `sW`;
+INSERT(`bP`,3,3,'')
+
+SELECT INSERT(`bP`,4,1,'') FROM `sW`;
+INSERT(`bP`,4,1,'')
+
+SELECT INSERT(`bP`,4,2,'') FROM `sW`;
+INSERT(`bP`,4,2,'')
+
+SELECT INSERT(`bP`,5,1,'') FROM `sW`;
+INSERT(`bP`,5,1,'')
+
+SELECT INSERT(`bP`,1,1,'@') FROM `sW`;
+INSERT(`bP`,1,1,'@')
+@
+SELECT INSERT(`bP`,1,2,'@@') FROM `sW`;
+INSERT(`bP`,1,2,'@@')
+@@
+SELECT INSERT(`bP`,1,3,'@@@') FROM `sW`;
+INSERT(`bP`,1,3,'@@@')
+@@@
+SELECT INSERT(`bP`,1,4,'@@@@') FROM `sW`;
+INSERT(`bP`,1,4,'@@@@')
+@@@@
+SELECT INSERT(`bP`,1,5,'@@@@@') FROM `sW`;
+INSERT(`bP`,1,5,'@@@@@')
+@@@@@
+SELECT INSERT(`bP`,2,1,'@') FROM `sW`;
+INSERT(`bP`,2,1,'@')
+@
+SELECT INSERT(`bP`,2,2,'@@') FROM `sW`;
+INSERT(`bP`,2,2,'@@')
+@@
+SELECT INSERT(`bP`,2,3,'@@@') FROM `sW`;
+INSERT(`bP`,2,3,'@@@')
+@@@
+SELECT INSERT(`bP`,2,4,'@@@@') FROM `sW`;
+INSERT(`bP`,2,4,'@@@@')
+@@@@
+SELECT INSERT(`bP`,3,1,'@') FROM `sW`;
+INSERT(`bP`,3,1,'@')
+@
+SELECT INSERT(`bP`,3,2,'@@') FROM `sW`;
+INSERT(`bP`,3,2,'@@')
+@@
+SELECT INSERT(`bP`,3,3,'@@@') FROM `sW`;
+INSERT(`bP`,3,3,'@@@')
+@@@
+SELECT INSERT(`bP`,4,1,'@') FROM `sW`;
+INSERT(`bP`,4,1,'@')
+@
+SELECT INSERT(`bP`,4,2,'@@') FROM `sW`;
+INSERT(`bP`,4,2,'@@')
+@@
+SELECT INSERT(`bP`,5,1,'@') FROM `sW`;
+INSERT(`bP`,5,1,'@')
+@
+SELECT INSERT(`bP`,1,1,'\') FROM `sX`;
+INSERT(`bP`,1,1,'\')
+\\\\\
+SELECT INSERT(`bP`,1,2,'\\' ) FROM `sX`;
+INSERT(`bP`,1,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,1,3,'\\\' ) FROM `sX`;
+INSERT(`bP`,1,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,1,4,'\\\\' ) FROM `sX`;
+INSERT(`bP`,1,4,'\\\\' )
+\\\\\
+SELECT INSERT(`bP`,1,5,'\\\\\' ) FROM `sX`;
+INSERT(`bP`,1,5,'\\\\\' )
+\\\\\
+SELECT INSERT(`bP`,2,1,'\') FROM `sX`;
+INSERT(`bP`,2,1,'\')
+\\\\\
+SELECT INSERT(`bP`,2,2,'\\' ) FROM `sX`;
+INSERT(`bP`,2,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,2,3,'\\\' ) FROM `sX`;
+INSERT(`bP`,2,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,2,4,'\\\\' ) FROM `sX`;
+INSERT(`bP`,2,4,'\\\\' )
+\\\\\
+SELECT INSERT(`bP`,3,1,'\') FROM `sX`;
+INSERT(`bP`,3,1,'\')
+\\\\\
+SELECT INSERT(`bP`,3,2,'\\' ) FROM `sX`;
+INSERT(`bP`,3,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,3,3,'\\\' ) FROM `sX`;
+INSERT(`bP`,3,3,'\\\' )
+\\\\\
+SELECT INSERT(`bP`,4,1,'\') FROM `sX`;
+INSERT(`bP`,4,1,'\')
+\\\\\
+SELECT INSERT(`bP`,4,2,'\\' ) FROM `sX`;
+INSERT(`bP`,4,2,'\\' )
+\\\\\
+SELECT INSERT(`bP`,5,1,'\') FROM `sX`;
+INSERT(`bP`,5,1,'\')
+\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_insert_ucs2.result b/mysql-test/suite/jp/r/jp_insert_ucs2.result
new file mode 100644
index 00000000..e382f385
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_insert_ucs2.result
@@ -0,0 +1,714 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+INSERT(`ã`,1,1,' ')
+
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+INSERT(`ã`,1,2,' ')
+
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+INSERT(`ã`,1,3,' ')
+
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+INSERT(`ã`,1,4,' ')
+
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+INSERT(`ã`,1,5,' ')
+
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+INSERT(`ã`,2,1,' ')
+
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+INSERT(`ã`,2,2,' ')
+
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+INSERT(`ã`,2,3,' ')
+
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+INSERT(`ã`,2,4,' ')
+
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+INSERT(`ã`,3,1,' ')
+
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+INSERT(`ã`,3,2,' ')
+
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+INSERT(`ã`,3,3,' ')
+
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+INSERT(`ã`,4,1,' ')
+
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+INSERT(`ã`,4,2,' ')
+
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+INSERT(`ã`,5,1,' ')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+ݏޏߏ
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+INSERT(`ã`,1,2,'' )
+ޏߏ
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+INSERT(`ã`,1,3,'' )
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+INSERT(`ã`,1,4,'' )
+
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+INSERT(`ã`,1,5,'' )
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+܏ޏߏ
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+INSERT(`ã`,2,2,'' )
+܏ߏ
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+INSERT(`ã`,2,3,'' )
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+INSERT(`ã`,2,4,'' )
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+܏ݏߏ
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+INSERT(`ã`,3,2,'' )
+܏ݏ
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+INSERT(`ã`,3,3,'' )
+܏ݏ
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+܏ݏޏ
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+INSERT(`ã`,4,2,'' )
+܏ݏޏ
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+܏ݏޏߏ
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+INSERT(`ã`,1,1,' ')
+
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+INSERT(`ã`,1,2,' ')
+
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+INSERT(`ã`,1,3,' ')
+
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+INSERT(`ã`,1,4,' ')
+
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+INSERT(`ã`,1,5,' ')
+
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+INSERT(`ã`,2,1,' ')
+
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+INSERT(`ã`,2,2,' ')
+
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+INSERT(`ã`,2,3,' ')
+
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+INSERT(`ã`,2,4,' ')
+
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+INSERT(`ã`,3,1,' ')
+
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+INSERT(`ã`,3,2,' ')
+
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+INSERT(`ã`,3,3,' ')
+
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+INSERT(`ã`,4,1,' ')
+
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+INSERT(`ã`,4,2,' ')
+
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+INSERT(`ã`,5,1,' ')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+ݏޏߏ
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+INSERT(`ã`,1,2,'' )
+ޏߏ
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+INSERT(`ã`,1,3,'' )
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+INSERT(`ã`,1,4,'' )
+
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+INSERT(`ã`,1,5,'' )
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+܏ޏߏ
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+܏ߏ
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+INSERT(`ã`,2,3,'' )
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+INSERT(`ã`,2,4,'' )
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+܏ݏߏ
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+INSERT(`ã`,3,2,'' )
+܏ݏ
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+INSERT(`ã`,3,3,'' )
+܏ݏ
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+܏ݏޏ
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+INSERT(`ã`,4,2,'' )
+܏ݏޏ
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+܏ݏޏߏ
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+INSERT(`ã`,1,1,' ')
+
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+INSERT(`ã`,1,2,' ')
+
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+INSERT(`ã`,1,3,' ')
+
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+INSERT(`ã`,1,4,' ')
+
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+INSERT(`ã`,1,5,' ')
+
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+INSERT(`ã`,2,1,' ')
+
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+INSERT(`ã`,2,2,' ')
+
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+INSERT(`ã`,2,3,' ')
+
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+INSERT(`ã`,2,4,' ')
+
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+INSERT(`ã`,3,1,' ')
+
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+INSERT(`ã`,3,2,' ')
+
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+INSERT(`ã`,3,3,' ')
+
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+INSERT(`ã`,4,1,' ')
+
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+INSERT(`ã`,4,2,' ')
+
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+INSERT(`ã`,5,1,' ')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+ݏޏߏ
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+INSERT(`ã`,1,2,'' )
+ޏߏ
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+INSERT(`ã`,1,3,'' )
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+INSERT(`ã`,1,4,'' )
+
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+INSERT(`ã`,1,5,'' )
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+܏ޏߏ
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+INSERT(`ã`,2,2,'' )
+܏ߏ
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+INSERT(`ã`,2,3,'' )
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+INSERT(`ã`,2,4,'' )
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+܏ݏߏ
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+INSERT(`ã`,3,2,'' )
+܏ݏ
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+INSERT(`ã`,3,3,'' )
+܏ݏ
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+܏ݏޏ
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+INSERT(`ã`,4,2,'' )
+܏ݏޏ
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_insert_ujis.result b/mysql-test/suite/jp/r/jp_insert_ujis.result
new file mode 100644
index 00000000..90576986
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_insert_ujis.result
@@ -0,0 +1,714 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+SET collation_connection = ujis_japanese_ci;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+INSERT(`ã`,1,1,' ')
+
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+INSERT(`ã`,1,2,' ')
+
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+INSERT(`ã`,1,3,' ')
+
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+INSERT(`ã`,1,4,' ')
+
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+INSERT(`ã`,1,5,' ')
+
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+INSERT(`ã`,2,1,' ')
+
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+INSERT(`ã`,2,2,' ')
+
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+INSERT(`ã`,2,3,' ')
+
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+INSERT(`ã`,2,4,' ')
+
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+INSERT(`ã`,3,1,' ')
+
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+INSERT(`ã`,3,2,' ')
+
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+INSERT(`ã`,3,3,' ')
+
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+INSERT(`ã`,4,1,' ')
+
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+INSERT(`ã`,4,2,' ')
+
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+INSERT(`ã`,5,1,' ')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+ݏޏߏ
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+INSERT(`ã`,1,2,'' )
+ޏߏ
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+INSERT(`ã`,1,3,'' )
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+INSERT(`ã`,1,4,'' )
+
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+INSERT(`ã`,1,5,'' )
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+܏ޏߏ
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+INSERT(`ã`,2,2,'' )
+܏ߏ
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+INSERT(`ã`,2,3,'' )
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+INSERT(`ã`,2,4,'' )
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+܏ݏߏ
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+INSERT(`ã`,3,2,'' )
+܏ݏ
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+INSERT(`ã`,3,3,'' )
+܏ݏ
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+܏ݏޏ
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+INSERT(`ã`,4,2,'' )
+܏ݏޏ
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+܏ݏޏߏ
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+INSERT(`ã`,1,1,' ')
+
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+INSERT(`ã`,1,2,' ')
+
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+INSERT(`ã`,1,3,' ')
+
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+INSERT(`ã`,1,4,' ')
+
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+INSERT(`ã`,1,5,' ')
+
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+INSERT(`ã`,2,1,' ')
+
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+INSERT(`ã`,2,2,' ')
+
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+INSERT(`ã`,2,3,' ')
+
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+INSERT(`ã`,2,4,' ')
+
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+INSERT(`ã`,3,1,' ')
+
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+INSERT(`ã`,3,2,' ')
+
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+INSERT(`ã`,3,3,' ')
+
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+INSERT(`ã`,4,1,' ')
+
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+INSERT(`ã`,4,2,' ')
+
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+INSERT(`ã`,5,1,' ')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+ݏޏߏ
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+INSERT(`ã`,1,2,'' )
+ޏߏ
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+INSERT(`ã`,1,3,'' )
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+INSERT(`ã`,1,4,'' )
+
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+INSERT(`ã`,1,5,'' )
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+܏ޏߏ
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+܏ߏ
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+INSERT(`ã`,2,3,'' )
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+INSERT(`ã`,2,4,'' )
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+܏ݏߏ
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+INSERT(`ã`,3,2,'' )
+܏ݏ
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+INSERT(`ã`,3,3,'' )
+܏ݏ
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+܏ݏޏ
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+INSERT(`ã`,4,2,'' )
+܏ݏޏ
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+܏ݏޏߏ
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+INSERT(`ã`,1,1,' ')
+
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+INSERT(`ã`,1,2,' ')
+
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+INSERT(`ã`,1,3,' ')
+
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+INSERT(`ã`,1,4,' ')
+
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+INSERT(`ã`,1,5,' ')
+
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+INSERT(`ã`,2,1,' ')
+
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+INSERT(`ã`,2,2,' ')
+
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+INSERT(`ã`,2,3,' ')
+
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+INSERT(`ã`,2,4,' ')
+
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+INSERT(`ã`,3,1,' ')
+
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+INSERT(`ã`,3,2,' ')
+
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+INSERT(`ã`,3,3,' ')
+
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+INSERT(`ã`,4,1,' ')
+
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+INSERT(`ã`,4,2,' ')
+
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+INSERT(`ã`,5,1,' ')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+INSERT(`ã`,1,2,'')
+
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+INSERT(`ã`,1,3,'')
+
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+INSERT(`ã`,1,4,'')
+
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+INSERT(`ã`,1,5,'')
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+INSERT(`ã`,2,2,'')
+
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+INSERT(`ã`,2,3,'')
+
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+INSERT(`ã`,2,4,'')
+
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+INSERT(`ã`,3,2,'')
+
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+INSERT(`ã`,3,3,'')
+
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+INSERT(`ã`,4,2,'')
+
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+INSERT(`ã`,1,1,'')
+ݏޏߏ
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+INSERT(`ã`,1,2,'' )
+ޏߏ
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+INSERT(`ã`,1,3,'' )
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+INSERT(`ã`,1,4,'' )
+
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+INSERT(`ã`,1,5,'' )
+
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+INSERT(`ã`,2,1,'')
+܏ޏߏ
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+INSERT(`ã`,2,2,'' )
+܏ߏ
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+INSERT(`ã`,2,3,'' )
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+INSERT(`ã`,2,4,'' )
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+INSERT(`ã`,3,1,'')
+܏ݏߏ
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+INSERT(`ã`,3,2,'' )
+܏ݏ
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+INSERT(`ã`,3,3,'' )
+܏ݏ
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+INSERT(`ã`,4,1,'')
+܏ݏޏ
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+INSERT(`ã`,4,2,'' )
+܏ݏޏ
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+INSERT(`ã`,5,1,'')
+܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_insert_utf8.result b/mysql-test/suite/jp/r/jp_insert_utf8.result
new file mode 100644
index 00000000..b49b13f8
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_insert_utf8.result
@@ -0,0 +1,713 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+SELECT INSERT(`C1`,1,1,'カ') FROM `T1`;
+INSERT(`C1`,1,1,'カ')
+カイウエオ
+SELECT INSERT(`C1`,1,2,'カカ') FROM `T1`;
+INSERT(`C1`,1,2,'カカ')
+カカウエオ
+SELECT INSERT(`C1`,1,3,'カカカ') FROM `T1`;
+INSERT(`C1`,1,3,'カカカ')
+カカカエオ
+SELECT INSERT(`C1`,1,4,'カカカカ') FROM `T1`;
+INSERT(`C1`,1,4,'カカカカ')
+カカカカオ
+SELECT INSERT(`C1`,1,5,'カカカカカ') FROM `T1`;
+INSERT(`C1`,1,5,'カカカカカ')
+カカカカカ
+SELECT INSERT(`C1`,2,1,'カ') FROM `T1`;
+INSERT(`C1`,2,1,'カ')
+アカウエオ
+SELECT INSERT(`C1`,2,2,'カカ') FROM `T1`;
+INSERT(`C1`,2,2,'カカ')
+アカカエオ
+SELECT INSERT(`C1`,2,3,'カカカ') FROM `T1`;
+INSERT(`C1`,2,3,'カカカ')
+アカカカオ
+SELECT INSERT(`C1`,2,4,'カカカカ') FROM `T1`;
+INSERT(`C1`,2,4,'カカカカ')
+アカカカカ
+SELECT INSERT(`C1`,3,1,'カ') FROM `T1`;
+INSERT(`C1`,3,1,'カ')
+アイカエオ
+SELECT INSERT(`C1`,3,2,'カカ') FROM `T1`;
+INSERT(`C1`,3,2,'カカ')
+アイカカオ
+SELECT INSERT(`C1`,3,3,'カカカ') FROM `T1`;
+INSERT(`C1`,3,3,'カカカ')
+アイカカカ
+SELECT INSERT(`C1`,4,1,'カ') FROM `T1`;
+INSERT(`C1`,4,1,'カ')
+アイウカオ
+SELECT INSERT(`C1`,4,2,'カカ') FROM `T1`;
+INSERT(`C1`,4,2,'カカ')
+アイウカカ
+SELECT INSERT(`C1`,5,1,'カ') FROM `T1`;
+INSERT(`C1`,5,1,'カ')
+アイウエカ
+SELECT INSERT(`C1`,1,1,' ') FROM `T1`;
+INSERT(`C1`,1,1,' ')
+ イウエオ
+SELECT INSERT(`C1`,1,2,' ') FROM `T1`;
+INSERT(`C1`,1,2,' ')
+ ウエオ
+SELECT INSERT(`C1`,1,3,' ') FROM `T1`;
+INSERT(`C1`,1,3,' ')
+ エオ
+SELECT INSERT(`C1`,1,4,' ') FROM `T1`;
+INSERT(`C1`,1,4,' ')
+ オ
+SELECT INSERT(`C1`,1,5,' ') FROM `T1`;
+INSERT(`C1`,1,5,' ')
+
+SELECT INSERT(`C1`,2,1,' ') FROM `T1`;
+INSERT(`C1`,2,1,' ')
+ア ウエオ
+SELECT INSERT(`C1`,2,2,' ') FROM `T1`;
+INSERT(`C1`,2,2,' ')
+ア エオ
+SELECT INSERT(`C1`,2,3,' ') FROM `T1`;
+INSERT(`C1`,2,3,' ')
+ア オ
+SELECT INSERT(`C1`,2,4,' ') FROM `T1`;
+INSERT(`C1`,2,4,' ')
+ア
+SELECT INSERT(`C1`,3,1,' ') FROM `T1`;
+INSERT(`C1`,3,1,' ')
+アイ エオ
+SELECT INSERT(`C1`,3,2,' ') FROM `T1`;
+INSERT(`C1`,3,2,' ')
+アイ オ
+SELECT INSERT(`C1`,3,3,' ') FROM `T1`;
+INSERT(`C1`,3,3,' ')
+アイ
+SELECT INSERT(`C1`,4,1,' ') FROM `T1`;
+INSERT(`C1`,4,1,' ')
+アイウ オ
+SELECT INSERT(`C1`,4,2,' ') FROM `T1`;
+INSERT(`C1`,4,2,' ')
+アイウ
+SELECT INSERT(`C1`,5,1,' ') FROM `T1`;
+INSERT(`C1`,5,1,' ')
+アイウエ
+SELECT INSERT(`C1`,1,1,'か') FROM `T2`;
+INSERT(`C1`,1,1,'か')
+かいうえお
+SELECT INSERT(`C1`,1,2,'かか') FROM `T2`;
+INSERT(`C1`,1,2,'かか')
+かかうえお
+SELECT INSERT(`C1`,1,3,'かかか') FROM `T2`;
+INSERT(`C1`,1,3,'かかか')
+かかかえお
+SELECT INSERT(`C1`,1,4,'かかかか') FROM `T2`;
+INSERT(`C1`,1,4,'かかかか')
+かかかかお
+SELECT INSERT(`C1`,1,5,'かかかかか') FROM `T2`;
+INSERT(`C1`,1,5,'かかかかか')
+かかかかか
+SELECT INSERT(`C1`,2,1,'か') FROM `T2`;
+INSERT(`C1`,2,1,'か')
+あかうえお
+SELECT INSERT(`C1`,2,2,'かか') FROM `T2`;
+INSERT(`C1`,2,2,'かか')
+あかかえお
+SELECT INSERT(`C1`,2,3,'かかか') FROM `T2`;
+INSERT(`C1`,2,3,'かかか')
+あかかかお
+SELECT INSERT(`C1`,2,4,'かかかか') FROM `T2`;
+INSERT(`C1`,2,4,'かかかか')
+あかかかか
+SELECT INSERT(`C1`,3,1,'か') FROM `T2`;
+INSERT(`C1`,3,1,'か')
+あいかえお
+SELECT INSERT(`C1`,3,2,'かか') FROM `T2`;
+INSERT(`C1`,3,2,'かか')
+あいかかお
+SELECT INSERT(`C1`,3,3,'かかか') FROM `T2`;
+INSERT(`C1`,3,3,'かかか')
+あいかかか
+SELECT INSERT(`C1`,4,1,'か') FROM `T2`;
+INSERT(`C1`,4,1,'か')
+あいうかお
+SELECT INSERT(`C1`,4,2,'かか') FROM `T2`;
+INSERT(`C1`,4,2,'かか')
+あいうかか
+SELECT INSERT(`C1`,5,1,'か') FROM `T2`;
+INSERT(`C1`,5,1,'か')
+あいうえか
+SELECT INSERT(`C1`,1,1,' ') FROM `T2`;
+INSERT(`C1`,1,1,' ')
+ いうえお
+SELECT INSERT(`C1`,1,2,'  ') FROM `T2`;
+INSERT(`C1`,1,2,'  ')
+  うえお
+SELECT INSERT(`C1`,1,3,'   ') FROM `T2`;
+INSERT(`C1`,1,3,'   ')
+   えお
+SELECT INSERT(`C1`,1,4,'    ') FROM `T2`;
+INSERT(`C1`,1,4,'    ')
+    お
+SELECT INSERT(`C1`,1,5,'     ') FROM `T2`;
+INSERT(`C1`,1,5,'     ')
+     
+SELECT INSERT(`C1`,2,1,' ') FROM `T2`;
+INSERT(`C1`,2,1,' ')
+あ うえお
+SELECT INSERT(`C1`,2,2,'  ') FROM `T2`;
+INSERT(`C1`,2,2,'  ')
+あ  えお
+SELECT INSERT(`C1`,2,3,'   ') FROM `T2`;
+INSERT(`C1`,2,3,'   ')
+あ   お
+SELECT INSERT(`C1`,2,4,'    ') FROM `T2`;
+INSERT(`C1`,2,4,'    ')
+あ    
+SELECT INSERT(`C1`,3,1,' ') FROM `T2`;
+INSERT(`C1`,3,1,' ')
+あい えお
+SELECT INSERT(`C1`,3,2,'  ') FROM `T2`;
+INSERT(`C1`,3,2,'  ')
+あい  お
+SELECT INSERT(`C1`,3,3,'   ') FROM `T2`;
+INSERT(`C1`,3,3,'   ')
+あい   
+SELECT INSERT(`C1`,4,1,' ') FROM `T2`;
+INSERT(`C1`,4,1,' ')
+あいう お
+SELECT INSERT(`C1`,4,2,'  ') FROM `T2`;
+INSERT(`C1`,4,2,'  ')
+あいう  
+SELECT INSERT(`C1`,5,1,' ') FROM `T2`;
+INSERT(`C1`,5,1,' ')
+あいうえ 
+SELECT INSERT(`C1`,1,1,'丂') FROM `T3`;
+INSERT(`C1`,1,1,'丂')
+丂龖龗龞龡
+SELECT INSERT(`C1`,1,2,'丂丂' ) FROM `T3`;
+INSERT(`C1`,1,2,'丂丂' )
+丂丂龗龞龡
+SELECT INSERT(`C1`,1,3,'丂丂丂' ) FROM `T3`;
+INSERT(`C1`,1,3,'丂丂丂' )
+丂丂丂龞龡
+SELECT INSERT(`C1`,1,4,'丂丂丂丂' ) FROM `T3`;
+INSERT(`C1`,1,4,'丂丂丂丂' )
+丂丂丂丂龡
+SELECT INSERT(`C1`,1,5,'丂丂丂丂丂' ) FROM `T3`;
+INSERT(`C1`,1,5,'丂丂丂丂丂' )
+丂丂丂丂丂
+SELECT INSERT(`C1`,2,1,'丂') FROM `T3`;
+INSERT(`C1`,2,1,'丂')
+龔丂龗龞龡
+SELECT INSERT(`C1`,2,2,'丂丂' ) FROM `T3`;
+INSERT(`C1`,2,2,'丂丂' )
+龔丂丂龞龡
+SELECT INSERT(`C1`,2,3,'丂丂丂' ) FROM `T3`;
+INSERT(`C1`,2,3,'丂丂丂' )
+龔丂丂丂龡
+SELECT INSERT(`C1`,2,4,'丂丂丂丂' ) FROM `T3`;
+INSERT(`C1`,2,4,'丂丂丂丂' )
+龔丂丂丂丂
+SELECT INSERT(`C1`,3,1,'丂') FROM `T3`;
+INSERT(`C1`,3,1,'丂')
+龔龖丂龞龡
+SELECT INSERT(`C1`,3,2,'丂丂' ) FROM `T3`;
+INSERT(`C1`,3,2,'丂丂' )
+龔龖丂丂龡
+SELECT INSERT(`C1`,3,3,'丂丂丂' ) FROM `T3`;
+INSERT(`C1`,3,3,'丂丂丂' )
+龔龖丂丂丂
+SELECT INSERT(`C1`,4,1,'丂') FROM `T3`;
+INSERT(`C1`,4,1,'丂')
+龔龖龗丂龡
+SELECT INSERT(`C1`,4,2,'丂丂' ) FROM `T3`;
+INSERT(`C1`,4,2,'丂丂' )
+龔龖龗丂丂
+SELECT INSERT(`C1`,5,1,'丂') FROM `T3`;
+INSERT(`C1`,5,1,'丂')
+龔龖龗龞丂
+SELECT INSERT(`C1`,1,1,'カ') FROM `T4`;
+INSERT(`C1`,1,1,'カ')
+カイウエオ
+SELECT INSERT(`C1`,1,2,'カカ') FROM `T4`;
+INSERT(`C1`,1,2,'カカ')
+カカウエオ
+SELECT INSERT(`C1`,1,3,'カカカ') FROM `T4`;
+INSERT(`C1`,1,3,'カカカ')
+カカカエオ
+SELECT INSERT(`C1`,1,4,'カカカカ') FROM `T4`;
+INSERT(`C1`,1,4,'カカカカ')
+カカカカオ
+SELECT INSERT(`C1`,1,5,'カカカカカ') FROM `T4`;
+INSERT(`C1`,1,5,'カカカカカ')
+カカカカカ
+SELECT INSERT(`C1`,2,1,'カ') FROM `T4`;
+INSERT(`C1`,2,1,'カ')
+アカウエオ
+SELECT INSERT(`C1`,2,2,'カカ') FROM `T4`;
+INSERT(`C1`,2,2,'カカ')
+アカカエオ
+SELECT INSERT(`C1`,2,3,'カカカ') FROM `T4`;
+INSERT(`C1`,2,3,'カカカ')
+アカカカオ
+SELECT INSERT(`C1`,2,4,'カカカカ') FROM `T4`;
+INSERT(`C1`,2,4,'カカカカ')
+アカカカカ
+SELECT INSERT(`C1`,3,1,'カ') FROM `T4`;
+INSERT(`C1`,3,1,'カ')
+アイカエオ
+SELECT INSERT(`C1`,3,2,'カカ') FROM `T4`;
+INSERT(`C1`,3,2,'カカ')
+アイカカオ
+SELECT INSERT(`C1`,3,3,'カカカ') FROM `T4`;
+INSERT(`C1`,3,3,'カカカ')
+アイカカカ
+SELECT INSERT(`C1`,4,1,'カ') FROM `T4`;
+INSERT(`C1`,4,1,'カ')
+アイウカオ
+SELECT INSERT(`C1`,4,2,'カカ') FROM `T4`;
+INSERT(`C1`,4,2,'カカ')
+アイウカカ
+SELECT INSERT(`C1`,5,1,'カ') FROM `T4`;
+INSERT(`C1`,5,1,'カ')
+アイウエカ
+SELECT INSERT(`C1`,1,1,' ') FROM `T4`;
+INSERT(`C1`,1,1,' ')
+ イウエオ
+SELECT INSERT(`C1`,1,2,' ') FROM `T4`;
+INSERT(`C1`,1,2,' ')
+ ウエオ
+SELECT INSERT(`C1`,1,3,' ') FROM `T4`;
+INSERT(`C1`,1,3,' ')
+ エオ
+SELECT INSERT(`C1`,1,4,' ') FROM `T4`;
+INSERT(`C1`,1,4,' ')
+ オ
+SELECT INSERT(`C1`,1,5,' ') FROM `T4`;
+INSERT(`C1`,1,5,' ')
+
+SELECT INSERT(`C1`,2,1,' ') FROM `T4`;
+INSERT(`C1`,2,1,' ')
+ア ウエオ
+SELECT INSERT(`C1`,2,2,' ') FROM `T4`;
+INSERT(`C1`,2,2,' ')
+ア エオ
+SELECT INSERT(`C1`,2,3,' ') FROM `T4`;
+INSERT(`C1`,2,3,' ')
+ア オ
+SELECT INSERT(`C1`,2,4,' ') FROM `T4`;
+INSERT(`C1`,2,4,' ')
+ア
+SELECT INSERT(`C1`,3,1,' ') FROM `T4`;
+INSERT(`C1`,3,1,' ')
+アイ エオ
+SELECT INSERT(`C1`,3,2,' ') FROM `T4`;
+INSERT(`C1`,3,2,' ')
+アイ オ
+SELECT INSERT(`C1`,3,3,' ') FROM `T4`;
+INSERT(`C1`,3,3,' ')
+アイ
+SELECT INSERT(`C1`,4,1,' ') FROM `T4`;
+INSERT(`C1`,4,1,' ')
+アイウ オ
+SELECT INSERT(`C1`,4,2,' ') FROM `T4`;
+INSERT(`C1`,4,2,' ')
+アイウ
+SELECT INSERT(`C1`,5,1,' ') FROM `T4`;
+INSERT(`C1`,5,1,' ')
+アイウエ
+SELECT INSERT(`C1`,1,1,'か') FROM `T5`;
+INSERT(`C1`,1,1,'か')
+かいうえお
+SELECT INSERT(`C1`,1,2,'かか') FROM `T5`;
+INSERT(`C1`,1,2,'かか')
+かかうえお
+SELECT INSERT(`C1`,1,3,'かかか') FROM `T5`;
+INSERT(`C1`,1,3,'かかか')
+かかかえお
+SELECT INSERT(`C1`,1,4,'かかかか') FROM `T5`;
+INSERT(`C1`,1,4,'かかかか')
+かかかかお
+SELECT INSERT(`C1`,1,5,'かかかかか') FROM `T5`;
+INSERT(`C1`,1,5,'かかかかか')
+かかかかか
+SELECT INSERT(`C1`,2,1,'か') FROM `T5`;
+INSERT(`C1`,2,1,'か')
+あかうえお
+SELECT INSERT(`C1`,2,2,'かか') FROM `T5`;
+INSERT(`C1`,2,2,'かか')
+あかかえお
+SELECT INSERT(`C1`,2,3,'かかか') FROM `T5`;
+INSERT(`C1`,2,3,'かかか')
+あかかかお
+SELECT INSERT(`C1`,2,4,'かかかか') FROM `T5`;
+INSERT(`C1`,2,4,'かかかか')
+あかかかか
+SELECT INSERT(`C1`,3,1,'か') FROM `T5`;
+INSERT(`C1`,3,1,'か')
+あいかえお
+SELECT INSERT(`C1`,3,2,'かか') FROM `T5`;
+INSERT(`C1`,3,2,'かか')
+あいかかお
+SELECT INSERT(`C1`,3,3,'かかか') FROM `T5`;
+INSERT(`C1`,3,3,'かかか')
+あいかかか
+SELECT INSERT(`C1`,4,1,'か') FROM `T5`;
+INSERT(`C1`,4,1,'か')
+あいうかお
+SELECT INSERT(`C1`,4,2,'かか') FROM `T5`;
+INSERT(`C1`,4,2,'かか')
+あいうかか
+SELECT INSERT(`C1`,5,1,'か') FROM `T5`;
+INSERT(`C1`,5,1,'か')
+あいうえか
+SELECT INSERT(`C1`,1,1,' ') FROM `T5`;
+INSERT(`C1`,1,1,' ')
+ いうえお
+SELECT INSERT(`C1`,1,2,'  ') FROM `T5`;
+INSERT(`C1`,1,2,'  ')
+  うえお
+SELECT INSERT(`C1`,1,3,'   ') FROM `T5`;
+INSERT(`C1`,1,3,'   ')
+   えお
+SELECT INSERT(`C1`,1,4,'    ') FROM `T5`;
+INSERT(`C1`,1,4,'    ')
+    お
+SELECT INSERT(`C1`,1,5,'     ') FROM `T5`;
+INSERT(`C1`,1,5,'     ')
+     
+SELECT INSERT(`C1`,2,1,' ') FROM `T5`;
+INSERT(`C1`,2,1,' ')
+あ うえお
+SELECT INSERT(`C1`,2,2,'  ') FROM `T5`;
+INSERT(`C1`,2,2,'  ')
+あ  えお
+SELECT INSERT(`C1`,2,3,'   ') FROM `T5`;
+INSERT(`C1`,2,3,'   ')
+あ   お
+SELECT INSERT(`C1`,2,4,'    ') FROM `T5`;
+INSERT(`C1`,2,4,'    ')
+あ    
+SELECT INSERT(`C1`,3,1,' ') FROM `T5`;
+INSERT(`C1`,3,1,' ')
+あい えお
+SELECT INSERT(`C1`,3,2,'  ') FROM `T5`;
+INSERT(`C1`,3,2,'  ')
+あい  お
+SELECT INSERT(`C1`,3,3,'   ') FROM `T5`;
+INSERT(`C1`,3,3,'   ')
+あい   
+SELECT INSERT(`C1`,4,1,' ') FROM `T5`;
+INSERT(`C1`,4,1,' ')
+あいう お
+SELECT INSERT(`C1`,4,2,'  ') FROM `T5`;
+INSERT(`C1`,4,2,'  ')
+あいう  
+SELECT INSERT(`C1`,5,1,' ') FROM `T5`;
+INSERT(`C1`,5,1,' ')
+あいうえ 
+SELECT INSERT(`C1`,1,1,'丂') FROM `T6`;
+INSERT(`C1`,1,1,'丂')
+丂龖龗龞龡
+SELECT INSERT(`C1`,1,2,'丂丂' ) FROM `T6`;
+INSERT(`C1`,1,2,'丂丂' )
+丂丂龗龞龡
+SELECT INSERT(`C1`,1,3,'丂丂丂' ) FROM `T6`;
+INSERT(`C1`,1,3,'丂丂丂' )
+丂丂丂龞龡
+SELECT INSERT(`C1`,1,4,'丂丂丂丂' ) FROM `T6`;
+INSERT(`C1`,1,4,'丂丂丂丂' )
+丂丂丂丂龡
+SELECT INSERT(`C1`,1,5,'丂丂丂丂丂' ) FROM `T6`;
+INSERT(`C1`,1,5,'丂丂丂丂丂' )
+丂丂丂丂丂
+SELECT INSERT(`C1`,2,1,'丂') FROM `T6`;
+INSERT(`C1`,2,1,'丂')
+龔丂龗龞龡
+SELECT INSERT(`C1`,2,2,'丂丂') FROM `T6`;
+INSERT(`C1`,2,2,'丂丂')
+龔丂丂龞龡
+SELECT INSERT(`C1`,2,3,'丂丂丂' ) FROM `T6`;
+INSERT(`C1`,2,3,'丂丂丂' )
+龔丂丂丂龡
+SELECT INSERT(`C1`,2,4,'丂丂丂丂' ) FROM `T6`;
+INSERT(`C1`,2,4,'丂丂丂丂' )
+龔丂丂丂丂
+SELECT INSERT(`C1`,3,1,'丂') FROM `T6`;
+INSERT(`C1`,3,1,'丂')
+龔龖丂龞龡
+SELECT INSERT(`C1`,3,2,'丂丂' ) FROM `T6`;
+INSERT(`C1`,3,2,'丂丂' )
+龔龖丂丂龡
+SELECT INSERT(`C1`,3,3,'丂丂丂' ) FROM `T6`;
+INSERT(`C1`,3,3,'丂丂丂' )
+龔龖丂丂丂
+SELECT INSERT(`C1`,4,1,'丂') FROM `T6`;
+INSERT(`C1`,4,1,'丂')
+龔龖龗丂龡
+SELECT INSERT(`C1`,4,2,'丂丂' ) FROM `T6`;
+INSERT(`C1`,4,2,'丂丂' )
+龔龖龗丂丂
+SELECT INSERT(`C1`,5,1,'丂') FROM `T6`;
+INSERT(`C1`,5,1,'丂')
+龔龖龗龞丂
+SELECT INSERT(`C1`,1,1,'カ') FROM `T7`;
+INSERT(`C1`,1,1,'カ')
+カイウエオ
+SELECT INSERT(`C1`,1,2,'カカ') FROM `T7`;
+INSERT(`C1`,1,2,'カカ')
+カカウエオ
+SELECT INSERT(`C1`,1,3,'カカカ') FROM `T7`;
+INSERT(`C1`,1,3,'カカカ')
+カカカエオ
+SELECT INSERT(`C1`,1,4,'カカカカ') FROM `T7`;
+INSERT(`C1`,1,4,'カカカカ')
+カカカカオ
+SELECT INSERT(`C1`,1,5,'カカカカカ') FROM `T7`;
+INSERT(`C1`,1,5,'カカカカカ')
+カカカカカ
+SELECT INSERT(`C1`,2,1,'カ') FROM `T7`;
+INSERT(`C1`,2,1,'カ')
+アカウエオ
+SELECT INSERT(`C1`,2,2,'カカ') FROM `T7`;
+INSERT(`C1`,2,2,'カカ')
+アカカエオ
+SELECT INSERT(`C1`,2,3,'カカカ') FROM `T7`;
+INSERT(`C1`,2,3,'カカカ')
+アカカカオ
+SELECT INSERT(`C1`,2,4,'カカカカ') FROM `T7`;
+INSERT(`C1`,2,4,'カカカカ')
+アカカカカ
+SELECT INSERT(`C1`,3,1,'カ') FROM `T7`;
+INSERT(`C1`,3,1,'カ')
+アイカエオ
+SELECT INSERT(`C1`,3,2,'カカ') FROM `T7`;
+INSERT(`C1`,3,2,'カカ')
+アイカカオ
+SELECT INSERT(`C1`,3,3,'カカカ') FROM `T7`;
+INSERT(`C1`,3,3,'カカカ')
+アイカカカ
+SELECT INSERT(`C1`,4,1,'カ') FROM `T7`;
+INSERT(`C1`,4,1,'カ')
+アイウカオ
+SELECT INSERT(`C1`,4,2,'カカ') FROM `T7`;
+INSERT(`C1`,4,2,'カカ')
+アイウカカ
+SELECT INSERT(`C1`,5,1,'カ') FROM `T7`;
+INSERT(`C1`,5,1,'カ')
+アイウエカ
+SELECT INSERT(`C1`,1,1,' ') FROM `T7`;
+INSERT(`C1`,1,1,' ')
+ イウエオ
+SELECT INSERT(`C1`,1,2,' ') FROM `T7`;
+INSERT(`C1`,1,2,' ')
+ ウエオ
+SELECT INSERT(`C1`,1,3,' ') FROM `T7`;
+INSERT(`C1`,1,3,' ')
+ エオ
+SELECT INSERT(`C1`,1,4,' ') FROM `T7`;
+INSERT(`C1`,1,4,' ')
+ オ
+SELECT INSERT(`C1`,1,5,' ') FROM `T7`;
+INSERT(`C1`,1,5,' ')
+
+SELECT INSERT(`C1`,2,1,' ') FROM `T7`;
+INSERT(`C1`,2,1,' ')
+ア ウエオ
+SELECT INSERT(`C1`,2,2,' ') FROM `T7`;
+INSERT(`C1`,2,2,' ')
+ア エオ
+SELECT INSERT(`C1`,2,3,' ') FROM `T7`;
+INSERT(`C1`,2,3,' ')
+ア オ
+SELECT INSERT(`C1`,2,4,' ') FROM `T7`;
+INSERT(`C1`,2,4,' ')
+ア
+SELECT INSERT(`C1`,3,1,' ') FROM `T7`;
+INSERT(`C1`,3,1,' ')
+アイ エオ
+SELECT INSERT(`C1`,3,2,' ') FROM `T7`;
+INSERT(`C1`,3,2,' ')
+アイ オ
+SELECT INSERT(`C1`,3,3,' ') FROM `T7`;
+INSERT(`C1`,3,3,' ')
+アイ
+SELECT INSERT(`C1`,4,1,' ') FROM `T7`;
+INSERT(`C1`,4,1,' ')
+アイウ オ
+SELECT INSERT(`C1`,4,2,' ') FROM `T7`;
+INSERT(`C1`,4,2,' ')
+アイウ
+SELECT INSERT(`C1`,5,1,' ') FROM `T7`;
+INSERT(`C1`,5,1,' ')
+アイウエ
+SELECT INSERT(`C1`,1,1,'か') FROM `T8`;
+INSERT(`C1`,1,1,'か')
+かいうえお
+SELECT INSERT(`C1`,1,2,'かか') FROM `T8`;
+INSERT(`C1`,1,2,'かか')
+かかうえお
+SELECT INSERT(`C1`,1,3,'かかか') FROM `T8`;
+INSERT(`C1`,1,3,'かかか')
+かかかえお
+SELECT INSERT(`C1`,1,4,'かかかか') FROM `T8`;
+INSERT(`C1`,1,4,'かかかか')
+かかかかお
+SELECT INSERT(`C1`,1,5,'かかかかか') FROM `T8`;
+INSERT(`C1`,1,5,'かかかかか')
+かかかかか
+SELECT INSERT(`C1`,2,1,'か') FROM `T8`;
+INSERT(`C1`,2,1,'か')
+あかうえお
+SELECT INSERT(`C1`,2,2,'かか') FROM `T8`;
+INSERT(`C1`,2,2,'かか')
+あかかえお
+SELECT INSERT(`C1`,2,3,'かかか') FROM `T8`;
+INSERT(`C1`,2,3,'かかか')
+あかかかお
+SELECT INSERT(`C1`,2,4,'かかかか') FROM `T8`;
+INSERT(`C1`,2,4,'かかかか')
+あかかかか
+SELECT INSERT(`C1`,3,1,'か') FROM `T8`;
+INSERT(`C1`,3,1,'か')
+あいかえお
+SELECT INSERT(`C1`,3,2,'かか') FROM `T8`;
+INSERT(`C1`,3,2,'かか')
+あいかかお
+SELECT INSERT(`C1`,3,3,'かかか') FROM `T8`;
+INSERT(`C1`,3,3,'かかか')
+あいかかか
+SELECT INSERT(`C1`,4,1,'か') FROM `T8`;
+INSERT(`C1`,4,1,'か')
+あいうかお
+SELECT INSERT(`C1`,4,2,'かか') FROM `T8`;
+INSERT(`C1`,4,2,'かか')
+あいうかか
+SELECT INSERT(`C1`,5,1,'か') FROM `T8`;
+INSERT(`C1`,5,1,'か')
+あいうえか
+SELECT INSERT(`C1`,1,1,' ') FROM `T8`;
+INSERT(`C1`,1,1,' ')
+ いうえお
+SELECT INSERT(`C1`,1,2,'  ') FROM `T8`;
+INSERT(`C1`,1,2,'  ')
+  うえお
+SELECT INSERT(`C1`,1,3,'   ') FROM `T8`;
+INSERT(`C1`,1,3,'   ')
+   えお
+SELECT INSERT(`C1`,1,4,'    ') FROM `T8`;
+INSERT(`C1`,1,4,'    ')
+    お
+SELECT INSERT(`C1`,1,5,'     ') FROM `T8`;
+INSERT(`C1`,1,5,'     ')
+     
+SELECT INSERT(`C1`,2,1,' ') FROM `T8`;
+INSERT(`C1`,2,1,' ')
+あ うえお
+SELECT INSERT(`C1`,2,2,'  ') FROM `T8`;
+INSERT(`C1`,2,2,'  ')
+あ  えお
+SELECT INSERT(`C1`,2,3,'   ') FROM `T8`;
+INSERT(`C1`,2,3,'   ')
+あ   お
+SELECT INSERT(`C1`,2,4,'    ') FROM `T8`;
+INSERT(`C1`,2,4,'    ')
+あ    
+SELECT INSERT(`C1`,3,1,' ') FROM `T8`;
+INSERT(`C1`,3,1,' ')
+あい えお
+SELECT INSERT(`C1`,3,2,'  ') FROM `T8`;
+INSERT(`C1`,3,2,'  ')
+あい  お
+SELECT INSERT(`C1`,3,3,'   ') FROM `T8`;
+INSERT(`C1`,3,3,'   ')
+あい   
+SELECT INSERT(`C1`,4,1,' ') FROM `T8`;
+INSERT(`C1`,4,1,' ')
+あいう お
+SELECT INSERT(`C1`,4,2,'  ') FROM `T8`;
+INSERT(`C1`,4,2,'  ')
+あいう  
+SELECT INSERT(`C1`,5,1,' ') FROM `T8`;
+INSERT(`C1`,5,1,' ')
+あいうえ 
+SELECT INSERT(`C1`,1,1,'丂') FROM `T9`;
+INSERT(`C1`,1,1,'丂')
+丂龖龗龞龡
+SELECT INSERT(`C1`,1,2,'丂丂' ) FROM `T9`;
+INSERT(`C1`,1,2,'丂丂' )
+丂丂龗龞龡
+SELECT INSERT(`C1`,1,3,'丂丂丂' ) FROM `T9`;
+INSERT(`C1`,1,3,'丂丂丂' )
+丂丂丂龞龡
+SELECT INSERT(`C1`,1,4,'丂丂丂丂' ) FROM `T9`;
+INSERT(`C1`,1,4,'丂丂丂丂' )
+丂丂丂丂龡
+SELECT INSERT(`C1`,1,5,'丂丂丂丂丂' ) FROM `T9`;
+INSERT(`C1`,1,5,'丂丂丂丂丂' )
+丂丂丂丂丂
+SELECT INSERT(`C1`,2,1,'丂') FROM `T9`;
+INSERT(`C1`,2,1,'丂')
+龔丂龗龞龡
+SELECT INSERT(`C1`,2,2,'丂丂' ) FROM `T9`;
+INSERT(`C1`,2,2,'丂丂' )
+龔丂丂龞龡
+SELECT INSERT(`C1`,2,3,'丂丂丂' ) FROM `T9`;
+INSERT(`C1`,2,3,'丂丂丂' )
+龔丂丂丂龡
+SELECT INSERT(`C1`,2,4,'丂丂丂丂' ) FROM `T9`;
+INSERT(`C1`,2,4,'丂丂丂丂' )
+龔丂丂丂丂
+SELECT INSERT(`C1`,3,1,'丂') FROM `T9`;
+INSERT(`C1`,3,1,'丂')
+龔龖丂龞龡
+SELECT INSERT(`C1`,3,2,'丂丂' ) FROM `T9`;
+INSERT(`C1`,3,2,'丂丂' )
+龔龖丂丂龡
+SELECT INSERT(`C1`,3,3,'丂丂丂' ) FROM `T9`;
+INSERT(`C1`,3,3,'丂丂丂' )
+龔龖丂丂丂
+SELECT INSERT(`C1`,4,1,'丂') FROM `T9`;
+INSERT(`C1`,4,1,'丂')
+龔龖龗丂龡
+SELECT INSERT(`C1`,4,2,'丂丂' ) FROM `T9`;
+INSERT(`C1`,4,2,'丂丂' )
+龔龖龗丂丂
+SELECT INSERT(`C1`,5,1,'丂') FROM `T9`;
+INSERT(`C1`,5,1,'丂')
+龔龖龗龞丂
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_instr_sjis.result b/mysql-test/suite/jp/r/jp_instr_sjis.result
new file mode 100644
index 00000000..b102b1a1
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_instr_sjis.result
@@ -0,0 +1,200 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+SELECT INSTR(`bP`,'') from `sP`;
+INSTR(`bP`,'')
+1
+SELECT INSTR(`bP`,'') from `sP`;
+INSTR(`bP`,'')
+2
+SELECT INSTR(`bP`,'') from `sP`;
+INSTR(`bP`,'')
+3
+SELECT INSTR(`bP`,'') from `sP`;
+INSTR(`bP`,'')
+4
+SELECT INSTR(`bP`,'') from `sP`;
+INSTR(`bP`,'')
+5
+SELECT INSTR(`bP`,'') from `sP`;
+INSTR(`bP`,'')
+0
+SELECT INSTR(`bP`,'') from `sQ`;
+INSTR(`bP`,'')
+1
+SELECT INSTR(`bP`,'') from `sQ`;
+INSTR(`bP`,'')
+2
+SELECT INSTR(`bP`,'') from `sQ`;
+INSTR(`bP`,'')
+3
+SELECT INSTR(`bP`,'') from `sQ`;
+INSTR(`bP`,'')
+4
+SELECT INSTR(`bP`,'') from `sQ`;
+INSTR(`bP`,'')
+5
+SELECT INSTR(`bP`,'') from `sQ`;
+INSTR(`bP`,'')
+0
+SELECT INSTR(`bP`,'\') from `sR`;
+INSTR(`bP`,'\')
+1
+SELECT INSTR(`bP`,'\') from `sR`;
+INSTR(`bP`,'\')
+2
+SELECT INSTR(`bP`,'\') from `sR`;
+INSTR(`bP`,'\')
+3
+SELECT INSTR(`bP`,'\') from `sR`;
+INSTR(`bP`,'\')
+4
+SELECT INSTR(`bP`,'\') from `sR`;
+INSTR(`bP`,'\')
+5
+SELECT INSTR(`bP`,'\') from `sR`;
+INSTR(`bP`,'\')
+0
+SELECT INSTR(`bP`,'') from `sS`;
+INSTR(`bP`,'')
+1
+SELECT INSTR(`bP`,'') from `sS`;
+INSTR(`bP`,'')
+2
+SELECT INSTR(`bP`,'') from `sS`;
+INSTR(`bP`,'')
+3
+SELECT INSTR(`bP`,'') from `sS`;
+INSTR(`bP`,'')
+4
+SELECT INSTR(`bP`,'') from `sS`;
+INSTR(`bP`,'')
+5
+SELECT INSTR(`bP`,'') from `sS`;
+INSTR(`bP`,'')
+0
+SELECT INSTR(`bP`,'') from `sT`;
+INSTR(`bP`,'')
+1
+SELECT INSTR(`bP`,'') from `sT`;
+INSTR(`bP`,'')
+2
+SELECT INSTR(`bP`,'') from `sT`;
+INSTR(`bP`,'')
+3
+SELECT INSTR(`bP`,'') from `sT`;
+INSTR(`bP`,'')
+4
+SELECT INSTR(`bP`,'') from `sT`;
+INSTR(`bP`,'')
+5
+SELECT INSTR(`bP`,'') from `sT`;
+INSTR(`bP`,'')
+0
+SELECT INSTR(`bP`,'\') from `sU`;
+INSTR(`bP`,'\')
+1
+SELECT INSTR(`bP`,'\') from `sU`;
+INSTR(`bP`,'\')
+2
+SELECT INSTR(`bP`,'\') from `sU`;
+INSTR(`bP`,'\')
+3
+SELECT INSTR(`bP`,'\') from `sU`;
+INSTR(`bP`,'\')
+4
+SELECT INSTR(`bP`,'\') from `sU`;
+INSTR(`bP`,'\')
+5
+SELECT INSTR(`bP`,'\') from `sU`;
+INSTR(`bP`,'\')
+0
+SELECT INSTR(`bP`,'') from `sV`;
+INSTR(`bP`,'')
+1
+SELECT INSTR(`bP`,'') from `sV`;
+INSTR(`bP`,'')
+2
+SELECT INSTR(`bP`,'') from `sV`;
+INSTR(`bP`,'')
+3
+SELECT INSTR(`bP`,'') from `sV`;
+INSTR(`bP`,'')
+4
+SELECT INSTR(`bP`,'') from `sV`;
+INSTR(`bP`,'')
+5
+SELECT INSTR(`bP`,'') from `sV`;
+INSTR(`bP`,'')
+0
+SELECT INSTR(`bP`,'') from `sW`;
+INSTR(`bP`,'')
+1
+SELECT INSTR(`bP`,'') from `sW`;
+INSTR(`bP`,'')
+2
+SELECT INSTR(`bP`,'') from `sW`;
+INSTR(`bP`,'')
+3
+SELECT INSTR(`bP`,'') from `sW`;
+INSTR(`bP`,'')
+4
+SELECT INSTR(`bP`,'') from `sW`;
+INSTR(`bP`,'')
+5
+SELECT INSTR(`bP`,'') from `sW`;
+INSTR(`bP`,'')
+0
+SELECT INSTR(`bP`,'\') from `sX`;
+INSTR(`bP`,'\')
+1
+SELECT INSTR(`bP`,'\') from `sX`;
+INSTR(`bP`,'\')
+2
+SELECT INSTR(`bP`,'\') from `sX`;
+INSTR(`bP`,'\')
+3
+SELECT INSTR(`bP`,'\') from `sX`;
+INSTR(`bP`,'\')
+4
+SELECT INSTR(`bP`,'\') from `sX`;
+INSTR(`bP`,'\')
+5
+SELECT INSTR(`bP`,'\') from `sX`;
+INSTR(`bP`,'\')
+0
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_instr_ucs2.result b/mysql-test/suite/jp/r/jp_instr_ucs2.result
new file mode 100644
index 00000000..5840bf49
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_instr_ucs2.result
@@ -0,0 +1,201 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_instr_ujis.result b/mysql-test/suite/jp/r/jp_instr_ujis.result
new file mode 100644
index 00000000..345d23ec
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_instr_ujis.result
@@ -0,0 +1,200 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+1
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+2
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+3
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+4
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+5
+SELECT INSTR(`ã`,'') from `ԣ`;
+INSTR(`ã`,'')
+0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_instr_utf8.result b/mysql-test/suite/jp/r/jp_instr_utf8.result
new file mode 100644
index 00000000..fb6b8c7c
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_instr_utf8.result
@@ -0,0 +1,200 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+SELECT INSTR(`C1`,'ア') from `T1`;
+INSTR(`C1`,'ア')
+1
+SELECT INSTR(`C1`,'イ') from `T1`;
+INSTR(`C1`,'イ')
+2
+SELECT INSTR(`C1`,'ウ') from `T1`;
+INSTR(`C1`,'ウ')
+3
+SELECT INSTR(`C1`,'エ') from `T1`;
+INSTR(`C1`,'エ')
+4
+SELECT INSTR(`C1`,'オ') from `T1`;
+INSTR(`C1`,'オ')
+5
+SELECT INSTR(`C1`,'ン') from `T1`;
+INSTR(`C1`,'ン')
+0
+SELECT INSTR(`C1`,'あ') from `T2`;
+INSTR(`C1`,'あ')
+1
+SELECT INSTR(`C1`,'い') from `T2`;
+INSTR(`C1`,'い')
+2
+SELECT INSTR(`C1`,'う') from `T2`;
+INSTR(`C1`,'う')
+3
+SELECT INSTR(`C1`,'え') from `T2`;
+INSTR(`C1`,'え')
+4
+SELECT INSTR(`C1`,'お') from `T2`;
+INSTR(`C1`,'お')
+5
+SELECT INSTR(`C1`,'ん') from `T2`;
+INSTR(`C1`,'ん')
+0
+SELECT INSTR(`C1`,'龔') from `T3`;
+INSTR(`C1`,'龔')
+1
+SELECT INSTR(`C1`,'龖') from `T3`;
+INSTR(`C1`,'龖')
+2
+SELECT INSTR(`C1`,'龗') from `T3`;
+INSTR(`C1`,'龗')
+3
+SELECT INSTR(`C1`,'龞') from `T3`;
+INSTR(`C1`,'龞')
+4
+SELECT INSTR(`C1`,'龡') from `T3`;
+INSTR(`C1`,'龡')
+5
+SELECT INSTR(`C1`,'丂') from `T3`;
+INSTR(`C1`,'丂')
+0
+SELECT INSTR(`C1`,'ア') from `T4`;
+INSTR(`C1`,'ア')
+1
+SELECT INSTR(`C1`,'イ') from `T4`;
+INSTR(`C1`,'イ')
+2
+SELECT INSTR(`C1`,'ウ') from `T4`;
+INSTR(`C1`,'ウ')
+3
+SELECT INSTR(`C1`,'エ') from `T4`;
+INSTR(`C1`,'エ')
+4
+SELECT INSTR(`C1`,'オ') from `T4`;
+INSTR(`C1`,'オ')
+5
+SELECT INSTR(`C1`,'ン') from `T4`;
+INSTR(`C1`,'ン')
+0
+SELECT INSTR(`C1`,'あ') from `T5`;
+INSTR(`C1`,'あ')
+1
+SELECT INSTR(`C1`,'い') from `T5`;
+INSTR(`C1`,'い')
+2
+SELECT INSTR(`C1`,'う') from `T5`;
+INSTR(`C1`,'う')
+3
+SELECT INSTR(`C1`,'え') from `T5`;
+INSTR(`C1`,'え')
+4
+SELECT INSTR(`C1`,'お') from `T5`;
+INSTR(`C1`,'お')
+5
+SELECT INSTR(`C1`,'ん') from `T5`;
+INSTR(`C1`,'ん')
+0
+SELECT INSTR(`C1`,'龔') from `T6`;
+INSTR(`C1`,'龔')
+1
+SELECT INSTR(`C1`,'龖') from `T6`;
+INSTR(`C1`,'龖')
+2
+SELECT INSTR(`C1`,'龗') from `T6`;
+INSTR(`C1`,'龗')
+3
+SELECT INSTR(`C1`,'龞') from `T6`;
+INSTR(`C1`,'龞')
+4
+SELECT INSTR(`C1`,'龡') from `T6`;
+INSTR(`C1`,'龡')
+5
+SELECT INSTR(`C1`,'丂') from `T6`;
+INSTR(`C1`,'丂')
+0
+SELECT INSTR(`C1`,'ア') from `T7`;
+INSTR(`C1`,'ア')
+1
+SELECT INSTR(`C1`,'イ') from `T7`;
+INSTR(`C1`,'イ')
+2
+SELECT INSTR(`C1`,'ウ') from `T7`;
+INSTR(`C1`,'ウ')
+3
+SELECT INSTR(`C1`,'エ') from `T7`;
+INSTR(`C1`,'エ')
+4
+SELECT INSTR(`C1`,'オ') from `T7`;
+INSTR(`C1`,'オ')
+5
+SELECT INSTR(`C1`,'ン') from `T7`;
+INSTR(`C1`,'ン')
+0
+SELECT INSTR(`C1`,'あ') from `T8`;
+INSTR(`C1`,'あ')
+1
+SELECT INSTR(`C1`,'い') from `T8`;
+INSTR(`C1`,'い')
+2
+SELECT INSTR(`C1`,'う') from `T8`;
+INSTR(`C1`,'う')
+3
+SELECT INSTR(`C1`,'え') from `T8`;
+INSTR(`C1`,'え')
+4
+SELECT INSTR(`C1`,'お') from `T8`;
+INSTR(`C1`,'お')
+5
+SELECT INSTR(`C1`,'ん') from `T8`;
+INSTR(`C1`,'ん')
+0
+SELECT INSTR(`C1`,'龔') from `T9`;
+INSTR(`C1`,'龔')
+1
+SELECT INSTR(`C1`,'龖') from `T9`;
+INSTR(`C1`,'龖')
+2
+SELECT INSTR(`C1`,'龗') from `T9`;
+INSTR(`C1`,'龗')
+3
+SELECT INSTR(`C1`,'龞') from `T9`;
+INSTR(`C1`,'龞')
+4
+SELECT INSTR(`C1`,'龡') from `T9`;
+INSTR(`C1`,'龡')
+5
+SELECT INSTR(`C1`,'丂') from `T9`;
+INSTR(`C1`,'丂')
+0
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_join_sjis.result b/mysql-test/suite/jp/r/jp_join_sjis.result
new file mode 100644
index 00000000..5e7e51e0
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_join_sjis.result
@@ -0,0 +1,443 @@
+DROP TABLE IF EXISTS `sPa`;
+DROP TABLE IF EXISTS `sPb`;
+DROP TABLE IF EXISTS `sQa`;
+DROP TABLE IF EXISTS `sQb`;
+DROP TABLE IF EXISTS `sRa`;
+DROP TABLE IF EXISTS `sRb`;
+DROP TABLE IF EXISTS `sSa`;
+DROP TABLE IF EXISTS `sSb`;
+DROP TABLE IF EXISTS `sTa`;
+DROP TABLE IF EXISTS `sTb`;
+DROP TABLE IF EXISTS `sUa`;
+DROP TABLE IF EXISTS `sUb`;
+DROP TABLE IF EXISTS `sVa`;
+DROP TABLE IF EXISTS `sVb`;
+DROP TABLE IF EXISTS `sWa`;
+DROP TABLE IF EXISTS `sWb`;
+DROP TABLE IF EXISTS `sXa`;
+DROP TABLE IF EXISTS `sXb`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sPa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sPb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sSa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sSb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sVa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sVb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sPa` VALUES (''),(''),('');
+INSERT INTO `sPb` VALUES ('');
+INSERT INTO `sQa` VALUES (''),(''),('');
+INSERT INTO `sQb` VALUES ('');
+INSERT INTO `sRa` VALUES ('\'),('\'),('\');
+INSERT INTO `sRb` VALUES ('\');
+INSERT INTO `sSa` VALUES (''),(''),('');
+INSERT INTO `sSb` VALUES ('');
+INSERT INTO `sTa` VALUES (''),(''),('');
+INSERT INTO `sTb` VALUES ('');
+INSERT INTO `sUa` VALUES ('\'),('\'),('\');
+INSERT INTO `sUb` VALUES ('\');
+INSERT INTO `sVa` VALUES (''),(''),('');
+INSERT INTO `sVb` VALUES ('');
+INSERT INTO `sWa` VALUES (''),(''),('');
+INSERT INTO `sWb` VALUES ('');
+INSERT INTO `sXa` VALUES ('\'),('\'),('\');
+INSERT INTO `sXb` VALUES ('\');
+SELECT * FROM `sPa` JOIN `sPb`;
+bP bP
+
+
+
+SELECT * FROM `sPa` INNER JOIN `sPb`;
+bP bP
+
+
+
+SELECT * FROM `sPa` JOIN `sPb` USING (`bP`);
+bP
+
+SELECT * FROM `sPa` INNER JOIN `sPb` USING (`bP`);
+bP
+
+SELECT * FROM `sPa` CROSS JOIN `sPb`;
+bP bP
+
+
+
+SELECT * FROM `sPa` LEFT JOIN `sPb` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sPa` LEFT JOIN `sPb` ON (`sPa`.`bP` = `sPb`.`bP`);
+bP bP
+
+ NULL
+ NULL
+SELECT * FROM `sPb` RIGHT JOIN `sPa` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sPb` RIGHT JOIN `sPa` ON (`sPa`.`bP` = `sPb`.`bP`);
+bP bP
+
+NULL
+NULL
+SELECT * FROM `sQa` JOIN `sQb`;
+bP bP
+
+
+
+SELECT * FROM `sQa` INNER JOIN `sQb`;
+bP bP
+
+
+
+SELECT * FROM `sQa` JOIN `sQb` USING (`bP`);
+bP
+
+SELECT * FROM `sQa` INNER JOIN `sQb` USING (`bP`);
+bP
+
+SELECT * FROM `sQa` CROSS JOIN `sQb`;
+bP bP
+
+
+
+SELECT * FROM `sQa` LEFT JOIN `sQb` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sQa` LEFT JOIN `sQb` ON (`sQa`.`bP` = `sQb`.`bP`);
+bP bP
+
+ NULL
+ NULL
+SELECT * FROM `sQb` RIGHT JOIN `sQa` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sQb` RIGHT JOIN `sQa` ON (`sQa`.`bP` = `sQb`.`bP`);
+bP bP
+
+NULL
+NULL
+SELECT * FROM `sRa` JOIN `sRb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sRa` INNER JOIN `sRb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sRa` JOIN `sRb` USING (`bP`);
+bP
+\
+SELECT * FROM `sRa` INNER JOIN `sRb` USING (`bP`);
+bP
+\
+SELECT * FROM `sRa` CROSS JOIN `sRb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sRa` LEFT JOIN `sRb` USING (`bP`);
+bP
+\
+\
+\
+SELECT * FROM `sRa` LEFT JOIN `sRb` ON (`sRa`.`bP` = `sRb`.`bP`);
+bP bP
+\ \
+\ NULL
+\ NULL
+SELECT * FROM `sRb` RIGHT JOIN `sRa` USING (`bP`);
+bP
+\
+\
+\
+SELECT * FROM `sRb` RIGHT JOIN `sRa` ON (`sRa`.`bP` = `sRb`.`bP`);
+bP bP
+\ \
+NULL \
+NULL \
+SELECT * FROM `sSa` JOIN `sSb`;
+bP bP
+
+
+
+SELECT * FROM `sSa` INNER JOIN `sSb`;
+bP bP
+
+
+
+SELECT * FROM `sSa` JOIN `sSb` USING (`bP`);
+bP
+
+SELECT * FROM `sSa` INNER JOIN `sSb` USING (`bP`);
+bP
+
+SELECT * FROM `sSa` CROSS JOIN `sSb`;
+bP bP
+
+
+
+SELECT * FROM `sSa` LEFT JOIN `sSb` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sSa` LEFT JOIN `sSb` ON (`sSa`.`bP` = `sSb`.`bP`);
+bP bP
+
+ NULL
+ NULL
+SELECT * FROM `sSb` RIGHT JOIN `sSa` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sSb` RIGHT JOIN `sSa` ON (`sSa`.`bP` = `sSb`.`bP`);
+bP bP
+
+NULL
+NULL
+SELECT * FROM `sTa` JOIN `sTb`;
+bP bP
+
+
+
+SELECT * FROM `sTa` INNER JOIN `sTb`;
+bP bP
+
+
+
+SELECT * FROM `sTa` JOIN `sTb` USING (`bP`);
+bP
+
+SELECT * FROM `sTa` INNER JOIN `sTb` USING (`bP`);
+bP
+
+SELECT * FROM `sTa` CROSS JOIN `sTb`;
+bP bP
+
+
+
+SELECT * FROM `sTa` LEFT JOIN `sTb` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sTa` LEFT JOIN `sTb` ON (`sTa`.`bP` = `sTb`.`bP`);
+bP bP
+
+ NULL
+ NULL
+SELECT * FROM `sTb` RIGHT JOIN `sTa` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sTb` RIGHT JOIN `sTa` ON (`sTa`.`bP` = `sTb`.`bP`);
+bP bP
+
+NULL
+NULL
+SELECT * FROM `sUa` JOIN `sUb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sUa` INNER JOIN `sUb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sUa` JOIN `sUb` USING (`bP`);
+bP
+\
+SELECT * FROM `sUa` INNER JOIN `sUb` USING (`bP`);
+bP
+\
+SELECT * FROM `sUa` CROSS JOIN `sUb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sUa` LEFT JOIN `sUb` USING (`bP`);
+bP
+\
+\
+\
+SELECT * FROM `sUa` LEFT JOIN `sUb` ON (`sUa`.`bP` = `sUb`.`bP`);
+bP bP
+\ \
+\ NULL
+\ NULL
+SELECT * FROM `sUb` RIGHT JOIN `sUa` USING (`bP`);
+bP
+\
+\
+\
+SELECT * FROM `sUb` RIGHT JOIN `sUa` ON (`sUa`.`bP` = `sUb`.`bP`);
+bP bP
+\ \
+NULL \
+NULL \
+SELECT * FROM `sVa` JOIN `sVb`;
+bP bP
+
+
+
+SELECT * FROM `sVa` INNER JOIN `sVb`;
+bP bP
+
+
+
+SELECT * FROM `sVa` JOIN `sVb` USING (`bP`);
+bP
+
+SELECT * FROM `sVa` INNER JOIN `sVb` USING (`bP`);
+bP
+
+SELECT * FROM `sVa` CROSS JOIN `sVb`;
+bP bP
+
+
+
+SELECT * FROM `sVa` LEFT JOIN `sVb` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sVa` LEFT JOIN `sVb` ON (`sVa`.`bP` = `sVb`.`bP`);
+bP bP
+
+ NULL
+ NULL
+SELECT * FROM `sVb` RIGHT JOIN `sVa` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sVb` RIGHT JOIN `sVa` ON (`sVa`.`bP` = `sVb`.`bP`);
+bP bP
+
+NULL
+NULL
+SELECT * FROM `sWa` JOIN `sWb`;
+bP bP
+
+
+
+SELECT * FROM `sWa` INNER JOIN `sWb`;
+bP bP
+
+
+
+SELECT * FROM `sWa` JOIN `sWb` USING (`bP`);
+bP
+
+SELECT * FROM `sWa` INNER JOIN `sWb` USING (`bP`);
+bP
+
+SELECT * FROM `sWa` CROSS JOIN `sWb`;
+bP bP
+
+
+
+SELECT * FROM `sWa` LEFT JOIN `sWb` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sWa` LEFT JOIN `sWb` ON (`sWa`.`bP` = `sWb`.`bP`);
+bP bP
+
+ NULL
+ NULL
+SELECT * FROM `sWb` RIGHT JOIN `sWa` USING (`bP`);
+bP
+
+
+
+SELECT * FROM `sWb` RIGHT JOIN `sWa` ON (`sWa`.`bP` = `sWb`.`bP`);
+bP bP
+
+NULL
+NULL
+SELECT * FROM `sXa` JOIN `sXb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sXa` INNER JOIN `sXb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sXa` JOIN `sXb` USING (`bP`);
+bP
+\
+SELECT * FROM `sXa` INNER JOIN `sXb` USING (`bP`);
+bP
+\
+SELECT * FROM `sXa` CROSS JOIN `sXb`;
+bP bP
+\ \
+\ \
+\ \
+SELECT * FROM `sXa` LEFT JOIN `sXb` USING (`bP`);
+bP
+\
+\
+\
+SELECT * FROM `sXa` LEFT JOIN `sXb` ON (`sXa`.`bP` = `sXb`.`bP`);
+bP bP
+\ \
+\ NULL
+\ NULL
+SELECT * FROM `sXb` RIGHT JOIN `sXa` USING (`bP`);
+bP
+\
+\
+\
+SELECT * FROM `sXb` RIGHT JOIN `sXa` ON (`sXa`.`bP` = `sXb`.`bP`);
+bP bP
+\ \
+NULL \
+NULL \
+DROP TABLE `sPa`;
+DROP TABLE `sPb`;
+DROP TABLE `sQa`;
+DROP TABLE `sQb`;
+DROP TABLE `sRa`;
+DROP TABLE `sRb`;
+DROP TABLE `sSa`;
+DROP TABLE `sSb`;
+DROP TABLE `sTa`;
+DROP TABLE `sTb`;
+DROP TABLE `sUa`;
+DROP TABLE `sUb`;
+DROP TABLE `sVa`;
+DROP TABLE `sVb`;
+DROP TABLE `sWa`;
+DROP TABLE `sWb`;
+DROP TABLE `sXa`;
+DROP TABLE `sXb`;
diff --git a/mysql-test/suite/jp/r/jp_join_ucs2.result b/mysql-test/suite/jp/r/jp_join_ucs2.result
new file mode 100644
index 00000000..d3ebd9c9
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_join_ucs2.result
@@ -0,0 +1,444 @@
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/r/jp_join_ujis.result b/mysql-test/suite/jp/r/jp_join_ujis.result
new file mode 100644
index 00000000..13de9dae
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_join_ujis.result
@@ -0,0 +1,443 @@
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+SELECT * FROM `ԣa` JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+ã ã
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+
+
+
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+ NULL
+ NULL
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+
+
+
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+ã ã
+
+NULL
+NULL
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/r/jp_join_utf8.result b/mysql-test/suite/jp/r/jp_join_utf8.result
new file mode 100644
index 00000000..a4781c0f
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_join_utf8.result
@@ -0,0 +1,443 @@
+drop table if exists `T1a`;
+drop table if exists `T1b`;
+drop table if exists `T2a`;
+drop table if exists `T2b`;
+drop table if exists `T3a`;
+drop table if exists `T3b`;
+drop table if exists `T4a`;
+drop table if exists `T4b`;
+drop table if exists `T5a`;
+drop table if exists `T5b`;
+drop table if exists `T6a`;
+drop table if exists `T6b`;
+drop table if exists `T7a`;
+drop table if exists `T7b`;
+drop table if exists `T8a`;
+drop table if exists `T8b`;
+drop table if exists `T9a`;
+drop table if exists `T9b`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T1b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T2a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T2b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T3a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T3b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T4a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T4b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T5a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T5b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T6a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T6b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T7a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T7b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T1b` VALUES ('ア');
+INSERT INTO `T2a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T2b` VALUES ('あ');
+INSERT INTO `T3a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T3b` VALUES ('龔');
+INSERT INTO `T4a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T4b` VALUES ('ア');
+INSERT INTO `T5a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T5b` VALUES ('あ');
+INSERT INTO `T6a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T6b` VALUES ('龔');
+INSERT INTO `T7a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T7b` VALUES ('ア');
+INSERT INTO `T8a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T8b` VALUES ('あ');
+INSERT INTO `T9a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T9b` VALUES ('龔');
+SELECT * FROM `T1a` JOIN `T1b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T1a` INNER JOIN `T1b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T1a` JOIN `T1b` USING (`C1`);
+C1
+ア
+SELECT * FROM `T1a` INNER JOIN `T1b` USING (`C1`);
+C1
+ア
+SELECT * FROM `T1a` CROSS JOIN `T1b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T1a` LEFT JOIN `T1b` USING (`C1`);
+C1
+ア
+カ
+サ
+SELECT * FROM `T1a` LEFT JOIN `T1b` ON (`T1a`.`C1` = `T1b`.`C1`);
+C1 C1
+ア ア
+カ NULL
+サ NULL
+SELECT * FROM `T1b` RIGHT JOIN `T1a` USING (`C1`);
+C1
+ア
+カ
+サ
+SELECT * FROM `T1b` RIGHT JOIN `T1a` ON (`T1a`.`C1` = `T1b`.`C1`);
+C1 C1
+ア ア
+NULL カ
+NULL サ
+SELECT * FROM `T2a` JOIN `T2b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T2a` INNER JOIN `T2b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T2a` JOIN `T2b` USING (`C1`);
+C1
+あ
+SELECT * FROM `T2a` INNER JOIN `T2b` USING (`C1`);
+C1
+あ
+SELECT * FROM `T2a` CROSS JOIN `T2b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T2a` LEFT JOIN `T2b` USING (`C1`);
+C1
+あ
+か
+さ
+SELECT * FROM `T2a` LEFT JOIN `T2b` ON (`T2a`.`C1` = `T2b`.`C1`);
+C1 C1
+あ あ
+か NULL
+さ NULL
+SELECT * FROM `T2b` RIGHT JOIN `T2a` USING (`C1`);
+C1
+あ
+か
+さ
+SELECT * FROM `T2b` RIGHT JOIN `T2a` ON (`T2a`.`C1` = `T2b`.`C1`);
+C1 C1
+あ あ
+NULL か
+NULL さ
+SELECT * FROM `T3a` JOIN `T3b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T3a` INNER JOIN `T3b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T3a` JOIN `T3b` USING (`C1`);
+C1
+龔
+SELECT * FROM `T3a` INNER JOIN `T3b` USING (`C1`);
+C1
+龔
+SELECT * FROM `T3a` CROSS JOIN `T3b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T3a` LEFT JOIN `T3b` USING (`C1`);
+C1
+龔
+龖
+龗
+SELECT * FROM `T3a` LEFT JOIN `T3b` ON (`T3a`.`C1` = `T3b`.`C1`);
+C1 C1
+龔 龔
+龖 NULL
+龗 NULL
+SELECT * FROM `T3b` RIGHT JOIN `T3a` USING (`C1`);
+C1
+龔
+龖
+龗
+SELECT * FROM `T3b` RIGHT JOIN `T3a` ON (`T3a`.`C1` = `T3b`.`C1`);
+C1 C1
+龔 龔
+NULL 龖
+NULL 龗
+SELECT * FROM `T4a` JOIN `T4b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T4a` INNER JOIN `T4b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T4a` JOIN `T4b` USING (`C1`);
+C1
+ア
+SELECT * FROM `T4a` INNER JOIN `T4b` USING (`C1`);
+C1
+ア
+SELECT * FROM `T4a` CROSS JOIN `T4b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T4a` LEFT JOIN `T4b` USING (`C1`);
+C1
+ア
+カ
+サ
+SELECT * FROM `T4a` LEFT JOIN `T4b` ON (`T4a`.`C1` = `T4b`.`C1`);
+C1 C1
+ア ア
+カ NULL
+サ NULL
+SELECT * FROM `T4b` RIGHT JOIN `T4a` USING (`C1`);
+C1
+ア
+カ
+サ
+SELECT * FROM `T4b` RIGHT JOIN `T4a` ON (`T4a`.`C1` = `T4b`.`C1`);
+C1 C1
+ア ア
+NULL カ
+NULL サ
+SELECT * FROM `T5a` JOIN `T5b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T5a` INNER JOIN `T5b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T5a` JOIN `T5b` USING (`C1`);
+C1
+あ
+SELECT * FROM `T5a` INNER JOIN `T5b` USING (`C1`);
+C1
+あ
+SELECT * FROM `T5a` CROSS JOIN `T5b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T5a` LEFT JOIN `T5b` USING (`C1`);
+C1
+あ
+か
+さ
+SELECT * FROM `T5a` LEFT JOIN `T5b` ON (`T5a`.`C1` = `T5b`.`C1`);
+C1 C1
+あ あ
+か NULL
+さ NULL
+SELECT * FROM `T5b` RIGHT JOIN `T5a` USING (`C1`);
+C1
+あ
+か
+さ
+SELECT * FROM `T5b` RIGHT JOIN `T5a` ON (`T5a`.`C1` = `T5b`.`C1`);
+C1 C1
+あ あ
+NULL か
+NULL さ
+SELECT * FROM `T6a` JOIN `T6b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T6a` INNER JOIN `T6b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T6a` JOIN `T6b` USING (`C1`);
+C1
+龔
+SELECT * FROM `T6a` INNER JOIN `T6b` USING (`C1`);
+C1
+龔
+SELECT * FROM `T6a` CROSS JOIN `T6b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T6a` LEFT JOIN `T6b` USING (`C1`);
+C1
+龔
+龖
+龗
+SELECT * FROM `T6a` LEFT JOIN `T6b` ON (`T6a`.`C1` = `T6b`.`C1`);
+C1 C1
+龔 龔
+龖 NULL
+龗 NULL
+SELECT * FROM `T6b` RIGHT JOIN `T6a` USING (`C1`);
+C1
+龔
+龖
+龗
+SELECT * FROM `T6b` RIGHT JOIN `T6a` ON (`T6a`.`C1` = `T6b`.`C1`);
+C1 C1
+龔 龔
+NULL 龖
+NULL 龗
+SELECT * FROM `T7a` JOIN `T7b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T7a` INNER JOIN `T7b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T7a` JOIN `T7b` USING (`C1`);
+C1
+ア
+SELECT * FROM `T7a` INNER JOIN `T7b` USING (`C1`);
+C1
+ア
+SELECT * FROM `T7a` CROSS JOIN `T7b`;
+C1 C1
+ア ア
+カ ア
+サ ア
+SELECT * FROM `T7a` LEFT JOIN `T7b` USING (`C1`);
+C1
+ア
+カ
+サ
+SELECT * FROM `T7a` LEFT JOIN `T7b` ON (`T7a`.`C1` = `T7b`.`C1`);
+C1 C1
+ア ア
+カ NULL
+サ NULL
+SELECT * FROM `T7b` RIGHT JOIN `T7a` USING (`C1`);
+C1
+ア
+カ
+サ
+SELECT * FROM `T7b` RIGHT JOIN `T7a` ON (`T7a`.`C1` = `T7b`.`C1`);
+C1 C1
+ア ア
+NULL カ
+NULL サ
+SELECT * FROM `T8a` JOIN `T8b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T8a` INNER JOIN `T8b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T8a` JOIN `T8b` USING (`C1`);
+C1
+あ
+SELECT * FROM `T8a` INNER JOIN `T8b` USING (`C1`);
+C1
+あ
+SELECT * FROM `T8a` CROSS JOIN `T8b`;
+C1 C1
+あ あ
+か あ
+さ あ
+SELECT * FROM `T8a` LEFT JOIN `T8b` USING (`C1`);
+C1
+あ
+か
+さ
+SELECT * FROM `T8a` LEFT JOIN `T8b` ON (`T8a`.`C1` = `T8b`.`C1`);
+C1 C1
+あ あ
+か NULL
+さ NULL
+SELECT * FROM `T8b` RIGHT JOIN `T8a` USING (`C1`);
+C1
+あ
+か
+さ
+SELECT * FROM `T8b` RIGHT JOIN `T8a` ON (`T8a`.`C1` = `T8b`.`C1`);
+C1 C1
+あ あ
+NULL か
+NULL さ
+SELECT * FROM `T9a` JOIN `T9b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T9a` INNER JOIN `T9b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T9a` JOIN `T9b` USING (`C1`);
+C1
+龔
+SELECT * FROM `T9a` INNER JOIN `T9b` USING (`C1`);
+C1
+龔
+SELECT * FROM `T9a` CROSS JOIN `T9b`;
+C1 C1
+龔 龔
+龖 龔
+龗 龔
+SELECT * FROM `T9a` LEFT JOIN `T9b` USING (`C1`);
+C1
+龔
+龖
+龗
+SELECT * FROM `T9a` LEFT JOIN `T9b` ON (`T9a`.`C1` = `T9b`.`C1`);
+C1 C1
+龔 龔
+龖 NULL
+龗 NULL
+SELECT * FROM `T9b` RIGHT JOIN `T9a` USING (`C1`);
+C1
+龔
+龖
+龗
+SELECT * FROM `T9b` RIGHT JOIN `T9a` ON (`T9a`.`C1` = `T9b`.`C1`);
+C1 C1
+龔 龔
+NULL 龖
+NULL 龗
+DROP TABLE `T1a`;
+DROP TABLE `T1b`;
+DROP TABLE `T2a`;
+DROP TABLE `T2b`;
+DROP TABLE `T3a`;
+DROP TABLE `T3b`;
+DROP TABLE `T4a`;
+DROP TABLE `T4b`;
+DROP TABLE `T5a`;
+DROP TABLE `T5b`;
+DROP TABLE `T6a`;
+DROP TABLE `T6b`;
+DROP TABLE `T7a`;
+DROP TABLE `T7b`;
+DROP TABLE `T8a`;
+DROP TABLE `T8b`;
+DROP TABLE `T9a`;
+DROP TABLE `T9b`;
diff --git a/mysql-test/suite/jp/r/jp_left_sjis.result b/mysql-test/suite/jp/r/jp_left_sjis.result
new file mode 100644
index 00000000..037fb052
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_left_sjis.result
@@ -0,0 +1,470 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, LEFT(`bP`,0) FROM `sP`;
+bP LEFT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sP`;
+bP LEFT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sP`;
+bP LEFT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sP`;
+bP LEFT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sP`;
+bP LEFT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sP`;
+bP LEFT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,0) FROM `sQ`;
+bP LEFT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sQ`;
+bP LEFT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sQ`;
+bP LEFT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sQ`;
+bP LEFT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sQ`;
+bP LEFT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sQ`;
+bP LEFT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,0) FROM `sR`;
+bP LEFT(`bP`,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, LEFT(`bP`,1) FROM `sR`;
+bP LEFT(`bP`,1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, LEFT(`bP`,2) FROM `sR`;
+bP LEFT(`bP`,2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, LEFT(`bP`,3) FROM `sR`;
+bP LEFT(`bP`,3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, LEFT(`bP`,4) FROM `sR`;
+bP LEFT(`bP`,4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, LEFT(`bP`,5) FROM `sR`;
+bP LEFT(`bP`,5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, LEFT(`bP`,0) FROM `sS`;
+bP LEFT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sS`;
+bP LEFT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sS`;
+bP LEFT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sS`;
+bP LEFT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sS`;
+bP LEFT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sS`;
+bP LEFT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,0) FROM `sT`;
+bP LEFT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sT`;
+bP LEFT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sT`;
+bP LEFT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sT`;
+bP LEFT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sT`;
+bP LEFT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sT`;
+bP LEFT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,0) FROM `sU`;
+bP LEFT(`bP`,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, LEFT(`bP`,1) FROM `sU`;
+bP LEFT(`bP`,1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, LEFT(`bP`,2) FROM `sU`;
+bP LEFT(`bP`,2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, LEFT(`bP`,3) FROM `sU`;
+bP LEFT(`bP`,3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, LEFT(`bP`,4) FROM `sU`;
+bP LEFT(`bP`,4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, LEFT(`bP`,5) FROM `sU`;
+bP LEFT(`bP`,5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, LEFT(`bP`,0) FROM `sV`;
+bP LEFT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sV`;
+bP LEFT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sV`;
+bP LEFT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sV`;
+bP LEFT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sV`;
+bP LEFT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sV`;
+bP LEFT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,0) FROM `sW`;
+bP LEFT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sW`;
+bP LEFT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sW`;
+bP LEFT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sW`;
+bP LEFT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sW`;
+bP LEFT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sW`;
+bP LEFT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, LEFT(`bP`,0) FROM `sX`;
+bP LEFT(`bP`,0)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, LEFT(`bP`,1) FROM `sX`;
+bP LEFT(`bP`,1)
+\\\\\ \
+\\\\ \
+\\\ \
+\\ \
+\ \
+
+SELECT `bP`, LEFT(`bP`,2) FROM `sX`;
+bP LEFT(`bP`,2)
+\\\\\ \\
+\\\\ \\
+\\\ \\
+\\ \\
+\ \
+
+SELECT `bP`, LEFT(`bP`,3) FROM `sX`;
+bP LEFT(`bP`,3)
+\\\\\ \\\
+\\\\ \\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, LEFT(`bP`,4) FROM `sX`;
+bP LEFT(`bP`,4)
+\\\\\ \\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, LEFT(`bP`,5) FROM `sX`;
+bP LEFT(`bP`,5)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_left_ucs2.result b/mysql-test/suite/jp/r/jp_left_ucs2.result
new file mode 100644
index 00000000..ca77bf7f
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_left_ucs2.result
@@ -0,0 +1,471 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+܏ݏޏߏ ܏
+܏ݏޏ ܏
+܏ݏ ܏
+܏ ܏
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+܏ݏޏߏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+܏ݏޏߏ ܏ݏޏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_left_ujis.result b/mysql-test/suite/jp/r/jp_left_ujis.result
new file mode 100644
index 00000000..50483f85
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_left_ujis.result
@@ -0,0 +1,470 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+ã LEFT(`ã`,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+ã LEFT(`ã`,1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+ã LEFT(`ã`,2)
+܏ݏޏߏ ܏
+܏ݏޏ ܏
+܏ݏ ܏
+܏ ܏
+
+
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+ã LEFT(`ã`,3)
+܏ݏޏߏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+ã LEFT(`ã`,4)
+܏ݏޏߏ ܏ݏޏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+ã LEFT(`ã`,5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_left_utf8.result b/mysql-test/suite/jp/r/jp_left_utf8.result
new file mode 100644
index 00000000..cfc1d853
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_left_utf8.result
@@ -0,0 +1,470 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, LEFT(`C1`,0) FROM `T1`;
+C1 LEFT(`C1`,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, LEFT(`C1`,1) FROM `T1`;
+C1 LEFT(`C1`,1)
+
+ア ア
+アイ ア
+アイウ ア
+アイウエ ア
+アイウエオ ア
+SELECT `C1`, LEFT(`C1`,2) FROM `T1`;
+C1 LEFT(`C1`,2)
+
+ア ア
+アイ アイ
+アイウ アイ
+アイウエ アイ
+アイウエオ アイ
+SELECT `C1`, LEFT(`C1`,3) FROM `T1`;
+C1 LEFT(`C1`,3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウ
+アイウエオ アイウ
+SELECT `C1`, LEFT(`C1`,4) FROM `T1`;
+C1 LEFT(`C1`,4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエ
+SELECT `C1`, LEFT(`C1`,5) FROM `T1`;
+C1 LEFT(`C1`,5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, LEFT(`C1`,0) FROM `T2`;
+C1 LEFT(`C1`,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, LEFT(`C1`,1) FROM `T2`;
+C1 LEFT(`C1`,1)
+
+あ あ
+あい あ
+あいう あ
+あいうえ あ
+あいうえお あ
+SELECT `C1`, LEFT(`C1`,2) FROM `T2`;
+C1 LEFT(`C1`,2)
+
+あ あ
+あい あい
+あいう あい
+あいうえ あい
+あいうえお あい
+SELECT `C1`, LEFT(`C1`,3) FROM `T2`;
+C1 LEFT(`C1`,3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいう
+あいうえお あいう
+SELECT `C1`, LEFT(`C1`,4) FROM `T2`;
+C1 LEFT(`C1`,4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえ
+SELECT `C1`, LEFT(`C1`,5) FROM `T2`;
+C1 LEFT(`C1`,5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, LEFT(`C1`,0) FROM `T3`;
+C1 LEFT(`C1`,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, LEFT(`C1`,1) FROM `T3`;
+C1 LEFT(`C1`,1)
+
+龔 龔
+龔龖 龔
+龔龖龗 龔
+龔龖龗龞 龔
+龔龖龗龞龡 龔
+SELECT `C1`, LEFT(`C1`,2) FROM `T3`;
+C1 LEFT(`C1`,2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖
+龔龖龗龞 龔龖
+龔龖龗龞龡 龔龖
+SELECT `C1`, LEFT(`C1`,3) FROM `T3`;
+C1 LEFT(`C1`,3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗龞龡 龔龖龗
+SELECT `C1`, LEFT(`C1`,4) FROM `T3`;
+C1 LEFT(`C1`,4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞
+SELECT `C1`, LEFT(`C1`,5) FROM `T3`;
+C1 LEFT(`C1`,5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, LEFT(`C1`,0) FROM `T4`;
+C1 LEFT(`C1`,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, LEFT(`C1`,1) FROM `T4`;
+C1 LEFT(`C1`,1)
+
+ア ア
+アイ ア
+アイウ ア
+アイウエ ア
+アイウエオ ア
+SELECT `C1`, LEFT(`C1`,2) FROM `T4`;
+C1 LEFT(`C1`,2)
+
+ア ア
+アイ アイ
+アイウ アイ
+アイウエ アイ
+アイウエオ アイ
+SELECT `C1`, LEFT(`C1`,3) FROM `T4`;
+C1 LEFT(`C1`,3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウ
+アイウエオ アイウ
+SELECT `C1`, LEFT(`C1`,4) FROM `T4`;
+C1 LEFT(`C1`,4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエ
+SELECT `C1`, LEFT(`C1`,5) FROM `T4`;
+C1 LEFT(`C1`,5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, LEFT(`C1`,0) FROM `T5`;
+C1 LEFT(`C1`,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, LEFT(`C1`,1) FROM `T5`;
+C1 LEFT(`C1`,1)
+
+あ あ
+あい あ
+あいう あ
+あいうえ あ
+あいうえお あ
+SELECT `C1`, LEFT(`C1`,2) FROM `T5`;
+C1 LEFT(`C1`,2)
+
+あ あ
+あい あい
+あいう あい
+あいうえ あい
+あいうえお あい
+SELECT `C1`, LEFT(`C1`,3) FROM `T5`;
+C1 LEFT(`C1`,3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいう
+あいうえお あいう
+SELECT `C1`, LEFT(`C1`,4) FROM `T5`;
+C1 LEFT(`C1`,4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえ
+SELECT `C1`, LEFT(`C1`,5) FROM `T5`;
+C1 LEFT(`C1`,5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, LEFT(`C1`,0) FROM `T6`;
+C1 LEFT(`C1`,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, LEFT(`C1`,1) FROM `T6`;
+C1 LEFT(`C1`,1)
+
+龔 龔
+龔龖 龔
+龔龖龗 龔
+龔龖龗龞 龔
+龔龖龗龞龡 龔
+SELECT `C1`, LEFT(`C1`,2) FROM `T6`;
+C1 LEFT(`C1`,2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖
+龔龖龗龞 龔龖
+龔龖龗龞龡 龔龖
+SELECT `C1`, LEFT(`C1`,3) FROM `T6`;
+C1 LEFT(`C1`,3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗龞龡 龔龖龗
+SELECT `C1`, LEFT(`C1`,4) FROM `T6`;
+C1 LEFT(`C1`,4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞
+SELECT `C1`, LEFT(`C1`,5) FROM `T6`;
+C1 LEFT(`C1`,5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, LEFT(`C1`,0) FROM `T7`;
+C1 LEFT(`C1`,0)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, LEFT(`C1`,1) FROM `T7`;
+C1 LEFT(`C1`,1)
+アイウエオ ア
+アイウエ ア
+アイウ ア
+アイ ア
+ア ア
+
+SELECT `C1`, LEFT(`C1`,2) FROM `T7`;
+C1 LEFT(`C1`,2)
+アイウエオ アイ
+アイウエ アイ
+アイウ アイ
+アイ アイ
+ア ア
+
+SELECT `C1`, LEFT(`C1`,3) FROM `T7`;
+C1 LEFT(`C1`,3)
+アイウエオ アイウ
+アイウエ アイウ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, LEFT(`C1`,4) FROM `T7`;
+C1 LEFT(`C1`,4)
+アイウエオ アイウエ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, LEFT(`C1`,5) FROM `T7`;
+C1 LEFT(`C1`,5)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, LEFT(`C1`,0) FROM `T8`;
+C1 LEFT(`C1`,0)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, LEFT(`C1`,1) FROM `T8`;
+C1 LEFT(`C1`,1)
+あいうえお あ
+あいうえ あ
+あいう あ
+あい あ
+あ あ
+
+SELECT `C1`, LEFT(`C1`,2) FROM `T8`;
+C1 LEFT(`C1`,2)
+あいうえお あい
+あいうえ あい
+あいう あい
+あい あい
+あ あ
+
+SELECT `C1`, LEFT(`C1`,3) FROM `T8`;
+C1 LEFT(`C1`,3)
+あいうえお あいう
+あいうえ あいう
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, LEFT(`C1`,4) FROM `T8`;
+C1 LEFT(`C1`,4)
+あいうえお あいうえ
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, LEFT(`C1`,5) FROM `T8`;
+C1 LEFT(`C1`,5)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, LEFT(`C1`,0) FROM `T9`;
+C1 LEFT(`C1`,0)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, LEFT(`C1`,1) FROM `T9`;
+C1 LEFT(`C1`,1)
+龔龖龗龞龡 龔
+龔龖龗龞 龔
+龔龖龗 龔
+龔龖 龔
+龔 龔
+
+SELECT `C1`, LEFT(`C1`,2) FROM `T9`;
+C1 LEFT(`C1`,2)
+龔龖龗龞龡 龔龖
+龔龖龗龞 龔龖
+龔龖龗 龔龖
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, LEFT(`C1`,3) FROM `T9`;
+C1 LEFT(`C1`,3)
+龔龖龗龞龡 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, LEFT(`C1`,4) FROM `T9`;
+C1 LEFT(`C1`,4)
+龔龖龗龞龡 龔龖龗龞
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, LEFT(`C1`,5) FROM `T9`;
+C1 LEFT(`C1`,5)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_length_sjis.result b/mysql-test/suite/jp/r/jp_length_sjis.result
new file mode 100644
index 00000000..5de25696
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_length_sjis.result
@@ -0,0 +1,110 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, LENGTH(`bP`) FROM `sP`;
+bP LENGTH(`bP`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `bP`, LENGTH(`bP`) FROM `sQ`;
+bP LENGTH(`bP`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `bP`, LENGTH(`bP`) FROM `sR`;
+bP LENGTH(`bP`)
+ 0
+\ 2
+\\ 4
+\\\ 6
+\\\\ 8
+\\\\\ 10
+SELECT `bP`, LENGTH(`bP`) FROM `sS`;
+bP LENGTH(`bP`)
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+SELECT `bP`, LENGTH(`bP`) FROM `sT`;
+bP LENGTH(`bP`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `bP`, LENGTH(`bP`) FROM `sU`;
+bP LENGTH(`bP`)
+ 0
+\ 2
+\\ 4
+\\\ 6
+\\\\ 8
+\\\\\ 10
+SELECT `bP`, LENGTH(`bP`) FROM `sV`;
+bP LENGTH(`bP`)
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+SELECT `bP`, LENGTH(`bP`) FROM `sW`;
+bP LENGTH(`bP`)
+ 10
+ 8
+ 6
+ 4
+ 2
+ 0
+SELECT `bP`, LENGTH(`bP`) FROM `sX`;
+bP LENGTH(`bP`)
+\\\\\ 10
+\\\\ 8
+\\\ 6
+\\ 4
+\ 2
+ 0
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_length_ucs2.result b/mysql-test/suite/jp/r/jp_length_ucs2.result
new file mode 100644
index 00000000..6c5cb3a7
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_length_ucs2.result
@@ -0,0 +1,111 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+܏ 4
+܏ݏ 6
+܏ݏޏ 8
+܏ݏޏߏ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+܏ 4
+܏ݏ 6
+܏ݏޏ 8
+܏ݏޏߏ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 10
+ 8
+ 6
+ 4
+ 2
+ 0
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 10
+ 8
+ 6
+ 4
+ 2
+ 0
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+܏ݏޏߏ 10
+܏ݏޏ 8
+܏ݏ 6
+܏ 4
+ 2
+ 0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_length_ujis.result b/mysql-test/suite/jp/r/jp_length_ujis.result
new file mode 100644
index 00000000..3b3d3d33
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_length_ujis.result
@@ -0,0 +1,110 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 3
+܏ 6
+܏ݏ 9
+܏ݏޏ 12
+܏ݏޏߏ 15
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 2
+ 4
+ 6
+ 8
+ 10
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 0
+ 3
+܏ 6
+܏ݏ 9
+܏ݏޏ 12
+܏ݏޏߏ 15
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 10
+ 8
+ 6
+ 4
+ 2
+ 0
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+ 10
+ 8
+ 6
+ 4
+ 2
+ 0
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+ã LENGTH(`ã`)
+܏ݏޏߏ 15
+܏ݏޏ 12
+܏ݏ 9
+܏ 6
+ 3
+ 0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_length_utf8.result b/mysql-test/suite/jp/r/jp_length_utf8.result
new file mode 100644
index 00000000..6d4d4e43
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_length_utf8.result
@@ -0,0 +1,110 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, LENGTH(`C1`) FROM `T1`;
+C1 LENGTH(`C1`)
+ 0
+ア 3
+アイ 6
+アイウ 9
+アイウエ 12
+アイウエオ 15
+SELECT `C1`, LENGTH(`C1`) FROM `T2`;
+C1 LENGTH(`C1`)
+ 0
+あ 3
+あい 6
+あいう 9
+あいうえ 12
+あいうえお 15
+SELECT `C1`, LENGTH(`C1`) FROM `T3`;
+C1 LENGTH(`C1`)
+ 0
+龔 3
+龔龖 6
+龔龖龗 9
+龔龖龗龞 12
+龔龖龗龞龡 15
+SELECT `C1`, LENGTH(`C1`) FROM `T4`;
+C1 LENGTH(`C1`)
+ 0
+ア 3
+アイ 6
+アイウ 9
+アイウエ 12
+アイウエオ 15
+SELECT `C1`, LENGTH(`C1`) FROM `T5`;
+C1 LENGTH(`C1`)
+ 0
+あ 3
+あい 6
+あいう 9
+あいうえ 12
+あいうえお 15
+SELECT `C1`, LENGTH(`C1`) FROM `T6`;
+C1 LENGTH(`C1`)
+ 0
+龔 3
+龔龖 6
+龔龖龗 9
+龔龖龗龞 12
+龔龖龗龞龡 15
+SELECT `C1`, LENGTH(`C1`) FROM `T7`;
+C1 LENGTH(`C1`)
+アイウエオ 15
+アイウエ 12
+アイウ 9
+アイ 6
+ア 3
+ 0
+SELECT `C1`, LENGTH(`C1`) FROM `T8`;
+C1 LENGTH(`C1`)
+あいうえお 15
+あいうえ 12
+あいう 9
+あい 6
+あ 3
+ 0
+SELECT `C1`, LENGTH(`C1`) FROM `T9`;
+C1 LENGTH(`C1`)
+龔龖龗龞龡 15
+龔龖龗龞 12
+龔龖龗 9
+龔龖 6
+龔 3
+ 0
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_like_sjis.result b/mysql-test/suite/jp/r/jp_like_sjis.result
new file mode 100644
index 00000000..0d9cfff5
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_like_sjis.result
@@ -0,0 +1,260 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+SELECT * FROM `sP` WHERE `bP` LIKE ' %';
+bP
+ !"#$%&'()*+,-./
+
+SELECT * FROM `sP` WHERE `bP` LIKE '% %';
+bP
+ !"#$%&'()*+,-./
+
+SELECT * FROM `sP` WHERE `bP` LIKE '% ';
+bP
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sP` WHERE `bP` LIKE '%%';
+bP
+
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sP` WHERE `bP` LIKE '%%';
+bP
+
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sQ` WHERE `bP` LIKE '@%';
+bP
+@@ABCDEFGHIJKLMNOPQR
+SELECT * FROM `sQ` WHERE `bP` LIKE '%@%';
+bP
+@@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEE@
+SELECT * FROM `sQ` WHERE `bP` LIKE '%@';
+bP
+EEEEEEEEEE@
+SELECT * FROM `sQ` WHERE `bP` LIKE '%';
+bP
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+SELECT * FROM `sQ` WHERE `bP` LIKE '%%';
+bP
+E
+SELECT * FROM `sQ` WHERE `bP` LIKE '%';
+bP
+ڂۂ܂݂ނ߂
+SELECT * FROM `sQ` WHERE `bP` LIKE 'E%';
+bP
+E
+SELECT * FROM `sQ` WHERE `bP` LIKE '%E%';
+bP
+E
+SELECT * FROM `sQ` WHERE `bP` LIKE '%E';
+bP
+E
+SELECT * FROM `sR` WHERE `bP` LIKE '\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sR` WHERE `bP` LIKE '%\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sR` WHERE `bP` LIKE '%\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sR` WHERE `bP` LIKE '\\\\\\\\\\\\\\\\\\\\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sR` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sR` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sS` WHERE `bP` LIKE ' %';
+bP
+ !"#$%&'()*+,-./
+
+SELECT * FROM `sS` WHERE `bP` LIKE '% %';
+bP
+ !"#$%&'()*+,-./
+
+SELECT * FROM `sS` WHERE `bP` LIKE '% ';
+bP
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sS` WHERE `bP` LIKE '%%';
+bP
+
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sS` WHERE `bP` LIKE '%%';
+bP
+
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sT` WHERE `bP` LIKE '@%';
+bP
+@@ABCDEFGHIJKLMNOPQR
+SELECT * FROM `sT` WHERE `bP` LIKE '%@%';
+bP
+@@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEE@
+SELECT * FROM `sT` WHERE `bP` LIKE '%@';
+bP
+EEEEEEEEEE@
+SELECT * FROM `sT` WHERE `bP` LIKE '%';
+bP
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+SELECT * FROM `sT` WHERE `bP` LIKE '%%';
+bP
+E
+SELECT * FROM `sT` WHERE `bP` LIKE '%';
+bP
+ڂۂ܂݂ނ߂
+SELECT * FROM `sT` WHERE `bP` LIKE 'E%';
+bP
+E
+SELECT * FROM `sT` WHERE `bP` LIKE '%E%';
+bP
+E
+SELECT * FROM `sT` WHERE `bP` LIKE '%E';
+bP
+E
+SELECT * FROM `sU` WHERE `bP` LIKE '\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sU` WHERE `bP` LIKE '%\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sU` WHERE `bP` LIKE '%\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sU` WHERE `bP` LIKE '\\\\\\\\\\\\\\\\\\\\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sU` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sU` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sV` WHERE `bP` LIKE ' %';
+bP
+ !"#$%&'()*+,-./
+
+SELECT * FROM `sV` WHERE `bP` LIKE '% %';
+bP
+ !"#$%&'()*+,-./
+
+SELECT * FROM `sV` WHERE `bP` LIKE '% ';
+bP
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sV` WHERE `bP` LIKE '%%';
+bP
+
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sV` WHERE `bP` LIKE '%%';
+bP
+
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+bP
+
+SELECT * FROM `sW` WHERE `bP` LIKE '@%';
+bP
+@@ABCDEFGHIJKLMNOPQR
+SELECT * FROM `sW` WHERE `bP` LIKE '%@%';
+bP
+@@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEE@
+SELECT * FROM `sW` WHERE `bP` LIKE '%@';
+bP
+EEEEEEEEEE@
+SELECT * FROM `sW` WHERE `bP` LIKE '%';
+bP
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+SELECT * FROM `sW` WHERE `bP` LIKE '%%';
+bP
+E
+SELECT * FROM `sW` WHERE `bP` LIKE '%';
+bP
+ڂۂ܂݂ނ߂
+SELECT * FROM `sW` WHERE `bP` LIKE 'E%';
+bP
+E
+SELECT * FROM `sW` WHERE `bP` LIKE '%E%';
+bP
+E
+SELECT * FROM `sW` WHERE `bP` LIKE '%E';
+bP
+E
+SELECT * FROM `sX` WHERE `bP` LIKE '\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sX` WHERE `bP` LIKE '%\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sX` WHERE `bP` LIKE '%\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sX` WHERE `bP` LIKE '\\\\\\\\\\\\\\\\\\\\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sX` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\%';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sX` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_like_ucs2.result b/mysql-test/suite/jp/r/jp_like_ucs2.result
new file mode 100644
index 00000000..5b0f5171
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_like_ucs2.result
@@ -0,0 +1,315 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('')
+,('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ')
+,('ܤݤޤߤ')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('')
+,('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ')
+,('ܤݤޤߤ')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('')
+,('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ')
+,('ܤݤޤߤ')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ܤݤޤߤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ܤݤޤߤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ܤݤޤߤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+ÏďŏƏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_like_ujis.result b/mysql-test/suite/jp/r/jp_like_ujis.result
new file mode 100644
index 00000000..a0cf0264
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_like_ujis.result
@@ -0,0 +1,260 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+ !"#$%&'()*+,-./
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+ !"#$%&'()*+,-./
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ܤݤޤߤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+ !"#$%&'()*+,-./
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+ !"#$%&'()*+,-./
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ܤݤޤߤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+ !"#$%&'()*+,-./
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+ !"#$%&'()*+,-./
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ܤݤޤߤ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+ÏďŏƏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_like_utf8.result b/mysql-test/suite/jp/r/jp_like_utf8.result
new file mode 100644
index 00000000..2ac95ba4
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_like_utf8.result
@@ -0,0 +1,260 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+SELECT * FROM `T1` WHERE `C1` LIKE ' %';
+C1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+SELECT * FROM `T1` WHERE `C1` LIKE '% %';
+C1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+SELECT * FROM `T1` WHERE `C1` LIKE '% ';
+C1
+SELECT * FROM `T1` WHERE `C1` LIKE 'タ%';
+C1
+タチツテトナニヌネノハヒフヘホマ
+SELECT * FROM `T1` WHERE `C1` LIKE '%ラリ%';
+C1
+ミムメモヤユヨラリルレロワン゙゚
+SELECT * FROM `T1` WHERE `C1` LIKE '%ソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T1` WHERE `C1` LIKE 'ーアイウエオカキクケコサシスセソ%';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T1` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ%';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T1` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T2` WHERE `C1` LIKE ' %';
+C1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+SELECT * FROM `T2` WHERE `C1` LIKE '% %';
+C1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+SELECT * FROM `T2` WHERE `C1` LIKE '% ';
+C1
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+SELECT * FROM `T2` WHERE `C1` LIKE 'と%';
+C1
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+SELECT * FROM `T2` WHERE `C1` LIKE '%あ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T2` WHERE `C1` LIKE '%わ';
+C1
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+SELECT * FROM `T2` WHERE `C1` LIKE '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T2` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T2` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T3` WHERE `C1` LIKE '鼫%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T3` WHERE `C1` LIKE '%鼺%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T3` WHERE `C1` LIKE '%齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T3` WHERE `C1` LIKE '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T3` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T3` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T4` WHERE `C1` LIKE ' %';
+C1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+SELECT * FROM `T4` WHERE `C1` LIKE '% %';
+C1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+SELECT * FROM `T4` WHERE `C1` LIKE '% ';
+C1
+SELECT * FROM `T4` WHERE `C1` LIKE 'タ%';
+C1
+タチツテトナニヌネノハヒフヘホマ
+SELECT * FROM `T4` WHERE `C1` LIKE '%ラリ%';
+C1
+ミムメモヤユヨラリルレロワン゙゚
+SELECT * FROM `T4` WHERE `C1` LIKE '%ソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T4` WHERE `C1` LIKE 'ーアイウエオカキクケコサシスセソ%';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T4` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ%';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T4` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T5` WHERE `C1` LIKE ' %';
+C1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+SELECT * FROM `T5` WHERE `C1` LIKE '% %';
+C1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+SELECT * FROM `T5` WHERE `C1` LIKE '% ';
+C1
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+SELECT * FROM `T5` WHERE `C1` LIKE 'と%';
+C1
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+SELECT * FROM `T5` WHERE `C1` LIKE '%あ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T5` WHERE `C1` LIKE '%わ';
+C1
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+SELECT * FROM `T5` WHERE `C1` LIKE '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T5` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T5` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T6` WHERE `C1` LIKE '鼫%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T6` WHERE `C1` LIKE '%鼺%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T6` WHERE `C1` LIKE '%齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T6` WHERE `C1` LIKE '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T6` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T6` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T7` WHERE `C1` LIKE ' %';
+C1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+SELECT * FROM `T7` WHERE `C1` LIKE '% %';
+C1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+SELECT * FROM `T7` WHERE `C1` LIKE '% ';
+C1
+SELECT * FROM `T7` WHERE `C1` LIKE 'タ%';
+C1
+タチツテトナニヌネノハヒフヘホマ
+SELECT * FROM `T7` WHERE `C1` LIKE '%ラリ%';
+C1
+ミムメモヤユヨラリルレロワン゙゚
+SELECT * FROM `T7` WHERE `C1` LIKE '%ソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T7` WHERE `C1` LIKE 'ーアイウエオカキクケコサシスセソ%';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T7` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ%';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T7` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T8` WHERE `C1` LIKE ' %';
+C1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+SELECT * FROM `T8` WHERE `C1` LIKE '% %';
+C1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+SELECT * FROM `T8` WHERE `C1` LIKE '% ';
+C1
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+SELECT * FROM `T8` WHERE `C1` LIKE 'と%';
+C1
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+SELECT * FROM `T8` WHERE `C1` LIKE '%あ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T8` WHERE `C1` LIKE '%わ';
+C1
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+SELECT * FROM `T8` WHERE `C1` LIKE '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T8` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T8` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T9` WHERE `C1` LIKE '鼫%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T9` WHERE `C1` LIKE '%鼺%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T9` WHERE `C1` LIKE '%齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T9` WHERE `C1` LIKE '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T9` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T9` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_locate_sjis.result b/mysql-test/suite/jp/r/jp_locate_sjis.result
new file mode 100644
index 00000000..623d1388
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_locate_sjis.result
@@ -0,0 +1,200 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+SELECT LOCATE('',`bP`) from `sP`;
+LOCATE('',`bP`)
+1
+SELECT LOCATE('',`bP`) from `sP`;
+LOCATE('',`bP`)
+2
+SELECT LOCATE('',`bP`) from `sP`;
+LOCATE('',`bP`)
+3
+SELECT LOCATE('',`bP`) from `sP`;
+LOCATE('',`bP`)
+4
+SELECT LOCATE('',`bP`) from `sP`;
+LOCATE('',`bP`)
+5
+SELECT LOCATE('',`bP`) from `sP`;
+LOCATE('',`bP`)
+0
+SELECT LOCATE('',`bP`) from `sQ`;
+LOCATE('',`bP`)
+1
+SELECT LOCATE('',`bP`) from `sQ`;
+LOCATE('',`bP`)
+2
+SELECT LOCATE('',`bP`) from `sQ`;
+LOCATE('',`bP`)
+3
+SELECT LOCATE('',`bP`) from `sQ`;
+LOCATE('',`bP`)
+4
+SELECT LOCATE('',`bP`) from `sQ`;
+LOCATE('',`bP`)
+5
+SELECT LOCATE('',`bP`) from `sQ`;
+LOCATE('',`bP`)
+0
+SELECT LOCATE('\',`bP`) from `sR`;
+LOCATE('\',`bP`)
+1
+SELECT LOCATE('\',`bP`) from `sR`;
+LOCATE('\',`bP`)
+2
+SELECT LOCATE('\',`bP`) from `sR`;
+LOCATE('\',`bP`)
+3
+SELECT LOCATE('\',`bP`) from `sR`;
+LOCATE('\',`bP`)
+4
+SELECT LOCATE('\',`bP`) from `sR`;
+LOCATE('\',`bP`)
+5
+SELECT LOCATE('\',`bP`) from `sR`;
+LOCATE('\',`bP`)
+0
+SELECT LOCATE('',`bP`) from `sS`;
+LOCATE('',`bP`)
+1
+SELECT LOCATE('',`bP`) from `sS`;
+LOCATE('',`bP`)
+2
+SELECT LOCATE('',`bP`) from `sS`;
+LOCATE('',`bP`)
+3
+SELECT LOCATE('',`bP`) from `sS`;
+LOCATE('',`bP`)
+4
+SELECT LOCATE('',`bP`) from `sS`;
+LOCATE('',`bP`)
+5
+SELECT LOCATE('',`bP`) from `sS`;
+LOCATE('',`bP`)
+0
+SELECT LOCATE('',`bP`) from `sT`;
+LOCATE('',`bP`)
+1
+SELECT LOCATE('',`bP`) from `sT`;
+LOCATE('',`bP`)
+2
+SELECT LOCATE('',`bP`) from `sT`;
+LOCATE('',`bP`)
+3
+SELECT LOCATE('',`bP`) from `sT`;
+LOCATE('',`bP`)
+4
+SELECT LOCATE('',`bP`) from `sT`;
+LOCATE('',`bP`)
+5
+SELECT LOCATE('',`bP`) from `sT`;
+LOCATE('',`bP`)
+0
+SELECT LOCATE('\',`bP`) from `sU`;
+LOCATE('\',`bP`)
+1
+SELECT LOCATE('\',`bP`) from `sU`;
+LOCATE('\',`bP`)
+2
+SELECT LOCATE('\',`bP`) from `sU`;
+LOCATE('\',`bP`)
+3
+SELECT LOCATE('\',`bP`) from `sU`;
+LOCATE('\',`bP`)
+4
+SELECT LOCATE('\',`bP`) from `sU`;
+LOCATE('\',`bP`)
+5
+SELECT LOCATE('\',`bP`) from `sU`;
+LOCATE('\',`bP`)
+0
+SELECT LOCATE('',`bP`) from `sV`;
+LOCATE('',`bP`)
+1
+SELECT LOCATE('',`bP`) from `sV`;
+LOCATE('',`bP`)
+2
+SELECT LOCATE('',`bP`) from `sV`;
+LOCATE('',`bP`)
+3
+SELECT LOCATE('',`bP`) from `sV`;
+LOCATE('',`bP`)
+4
+SELECT LOCATE('',`bP`) from `sV`;
+LOCATE('',`bP`)
+5
+SELECT LOCATE('',`bP`) from `sV`;
+LOCATE('',`bP`)
+0
+SELECT LOCATE('',`bP`) from `sW`;
+LOCATE('',`bP`)
+1
+SELECT LOCATE('',`bP`) from `sW`;
+LOCATE('',`bP`)
+2
+SELECT LOCATE('',`bP`) from `sW`;
+LOCATE('',`bP`)
+3
+SELECT LOCATE('',`bP`) from `sW`;
+LOCATE('',`bP`)
+4
+SELECT LOCATE('',`bP`) from `sW`;
+LOCATE('',`bP`)
+5
+SELECT LOCATE('',`bP`) from `sW`;
+LOCATE('',`bP`)
+0
+SELECT LOCATE('\',`bP`) from `sX`;
+LOCATE('\',`bP`)
+1
+SELECT LOCATE('\',`bP`) from `sX`;
+LOCATE('\',`bP`)
+2
+SELECT LOCATE('\',`bP`) from `sX`;
+LOCATE('\',`bP`)
+3
+SELECT LOCATE('\',`bP`) from `sX`;
+LOCATE('\',`bP`)
+4
+SELECT LOCATE('\',`bP`) from `sX`;
+LOCATE('\',`bP`)
+5
+SELECT LOCATE('\',`bP`) from `sX`;
+LOCATE('\',`bP`)
+0
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_locate_ucs2.result b/mysql-test/suite/jp/r/jp_locate_ucs2.result
new file mode 100644
index 00000000..357f1c23
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_locate_ucs2.result
@@ -0,0 +1,201 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_locate_ujis.result b/mysql-test/suite/jp/r/jp_locate_ujis.result
new file mode 100644
index 00000000..45560d2f
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_locate_ujis.result
@@ -0,0 +1,200 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+1
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+2
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+3
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+4
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+5
+SELECT LOCATE('',`ã`) from `ԣ`;
+LOCATE('',`ã`)
+0
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_locate_utf8.result b/mysql-test/suite/jp/r/jp_locate_utf8.result
new file mode 100644
index 00000000..162d03e6
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_locate_utf8.result
@@ -0,0 +1,200 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+SELECT LOCATE('ア',`C1`) from `T1`;
+LOCATE('ア',`C1`)
+1
+SELECT LOCATE('イ',`C1`) from `T1`;
+LOCATE('イ',`C1`)
+2
+SELECT LOCATE('ウ',`C1`) from `T1`;
+LOCATE('ウ',`C1`)
+3
+SELECT LOCATE('エ',`C1`) from `T1`;
+LOCATE('エ',`C1`)
+4
+SELECT LOCATE('オ',`C1`) from `T1`;
+LOCATE('オ',`C1`)
+5
+SELECT LOCATE('ン',`C1`) from `T1`;
+LOCATE('ン',`C1`)
+0
+SELECT LOCATE('あ',`C1`) from `T2`;
+LOCATE('あ',`C1`)
+1
+SELECT LOCATE('い',`C1`) from `T2`;
+LOCATE('い',`C1`)
+2
+SELECT LOCATE('う',`C1`) from `T2`;
+LOCATE('う',`C1`)
+3
+SELECT LOCATE('え',`C1`) from `T2`;
+LOCATE('え',`C1`)
+4
+SELECT LOCATE('お',`C1`) from `T2`;
+LOCATE('お',`C1`)
+5
+SELECT LOCATE('ん',`C1`) from `T2`;
+LOCATE('ん',`C1`)
+0
+SELECT LOCATE('龔',`C1`) from `T3`;
+LOCATE('龔',`C1`)
+1
+SELECT LOCATE('龖',`C1`) from `T3`;
+LOCATE('龖',`C1`)
+2
+SELECT LOCATE('龗',`C1`) from `T3`;
+LOCATE('龗',`C1`)
+3
+SELECT LOCATE('龞',`C1`) from `T3`;
+LOCATE('龞',`C1`)
+4
+SELECT LOCATE('龡',`C1`) from `T3`;
+LOCATE('龡',`C1`)
+5
+SELECT LOCATE('丂',`C1`) from `T3`;
+LOCATE('丂',`C1`)
+0
+SELECT LOCATE('ア',`C1`) from `T4`;
+LOCATE('ア',`C1`)
+1
+SELECT LOCATE('イ',`C1`) from `T4`;
+LOCATE('イ',`C1`)
+2
+SELECT LOCATE('ウ',`C1`) from `T4`;
+LOCATE('ウ',`C1`)
+3
+SELECT LOCATE('エ',`C1`) from `T4`;
+LOCATE('エ',`C1`)
+4
+SELECT LOCATE('オ',`C1`) from `T4`;
+LOCATE('オ',`C1`)
+5
+SELECT LOCATE('ン',`C1`) from `T4`;
+LOCATE('ン',`C1`)
+0
+SELECT LOCATE('あ',`C1`) from `T5`;
+LOCATE('あ',`C1`)
+1
+SELECT LOCATE('い',`C1`) from `T5`;
+LOCATE('い',`C1`)
+2
+SELECT LOCATE('う',`C1`) from `T5`;
+LOCATE('う',`C1`)
+3
+SELECT LOCATE('え',`C1`) from `T5`;
+LOCATE('え',`C1`)
+4
+SELECT LOCATE('お',`C1`) from `T5`;
+LOCATE('お',`C1`)
+5
+SELECT LOCATE('ん',`C1`) from `T5`;
+LOCATE('ん',`C1`)
+0
+SELECT LOCATE('龔',`C1`) from `T6`;
+LOCATE('龔',`C1`)
+1
+SELECT LOCATE('龖',`C1`) from `T6`;
+LOCATE('龖',`C1`)
+2
+SELECT LOCATE('龗',`C1`) from `T6`;
+LOCATE('龗',`C1`)
+3
+SELECT LOCATE('龞',`C1`) from `T6`;
+LOCATE('龞',`C1`)
+4
+SELECT LOCATE('龡',`C1`) from `T6`;
+LOCATE('龡',`C1`)
+5
+SELECT LOCATE('丂',`C1`) from `T6`;
+LOCATE('丂',`C1`)
+0
+SELECT LOCATE('ア',`C1`) from `T7`;
+LOCATE('ア',`C1`)
+1
+SELECT LOCATE('イ',`C1`) from `T7`;
+LOCATE('イ',`C1`)
+2
+SELECT LOCATE('ウ',`C1`) from `T7`;
+LOCATE('ウ',`C1`)
+3
+SELECT LOCATE('エ',`C1`) from `T7`;
+LOCATE('エ',`C1`)
+4
+SELECT LOCATE('オ',`C1`) from `T7`;
+LOCATE('オ',`C1`)
+5
+SELECT LOCATE('ン',`C1`) from `T7`;
+LOCATE('ン',`C1`)
+0
+SELECT LOCATE('あ',`C1`) from `T8`;
+LOCATE('あ',`C1`)
+1
+SELECT LOCATE('い',`C1`) from `T8`;
+LOCATE('い',`C1`)
+2
+SELECT LOCATE('う',`C1`) from `T8`;
+LOCATE('う',`C1`)
+3
+SELECT LOCATE('え',`C1`) from `T8`;
+LOCATE('え',`C1`)
+4
+SELECT LOCATE('お',`C1`) from `T8`;
+LOCATE('お',`C1`)
+5
+SELECT LOCATE('ん',`C1`) from `T8`;
+LOCATE('ん',`C1`)
+0
+SELECT LOCATE('龔',`C1`) from `T9`;
+LOCATE('龔',`C1`)
+1
+SELECT LOCATE('龖',`C1`) from `T9`;
+LOCATE('龖',`C1`)
+2
+SELECT LOCATE('龗',`C1`) from `T9`;
+LOCATE('龗',`C1`)
+3
+SELECT LOCATE('龞',`C1`) from `T9`;
+LOCATE('龞',`C1`)
+4
+SELECT LOCATE('龡',`C1`) from `T9`;
+LOCATE('龡',`C1`)
+5
+SELECT LOCATE('丂',`C1`) from `T9`;
+LOCATE('丂',`C1`)
+0
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_lpad_sjis.result b/mysql-test/suite/jp/r/jp_lpad_sjis.result
new file mode 100644
index 00000000..46cbde52
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_lpad_sjis.result
@@ -0,0 +1,110 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, LPAD(`bP`,5,'') FROM `sP`;
+bP LPAD(`bP`,5,'')
+
+
+
+
+
+
+SELECT `bP`, LPAD(`bP`,5,'w') FROM `sQ`;
+bP LPAD(`bP`,5,'w')
+ wwwww
+ wwww
+ www
+ ww
+ w
+
+SELECT `bP`, LPAD(`bP`,5,'\') FROM `sR`;
+bP LPAD(`bP`,5,'\')
+ \\\\\
+\ \\\\\
+\\ \\\\\
+\\\ \\\\\
+\\\\ \\\\\
+\\\\\ \\\\\
+SELECT `bP`, LPAD(`bP`,5,'') FROM `sS`;
+bP LPAD(`bP`,5,'')
+
+
+
+
+
+
+SELECT `bP`, LPAD(`bP`,5,'w') FROM `sT`;
+bP LPAD(`bP`,5,'w')
+ wwwww
+ wwww
+ www
+ ww
+ w
+
+SELECT `bP`, LPAD(`bP`,5,'\' ) FROM `sU`;
+bP LPAD(`bP`,5,'\' )
+ \\\\\
+\ \\\\\
+\\ \\\\\
+\\\ \\\\\
+\\\\ \\\\\
+\\\\\ \\\\\
+SELECT `bP`, LPAD(`bP`,5,'') FROM `sV`;
+bP LPAD(`bP`,5,'')
+
+
+
+
+
+
+SELECT `bP`, LPAD(`bP`,5,'w') FROM `sW`;
+bP LPAD(`bP`,5,'w')
+
+ w
+ ww
+ www
+ wwww
+ wwwww
+SELECT `bP`, LPAD(`bP`,5,'\' ) FROM `sX`;
+bP LPAD(`bP`,5,'\' )
+\\\\\ \\\\\
+\\\\ \\\\\
+\\\ \\\\\
+\\ \\\\\
+\ \\\\\
+ \\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_lpad_ucs2.result b/mysql-test/suite/jp/r/jp_lpad_ucs2.result
new file mode 100644
index 00000000..f5ba98db
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_lpad_ucs2.result
@@ -0,0 +1,111 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+ أأأأ
+ أأأؤ
+ أأؤ
+ أؤ
+ ؤ
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+ أأأأ
+ أأأؤ
+ أأؤ
+ أؤ
+ ؤ
+
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+ã LPAD(`ã`,5,'' )
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+ ؤ
+ أؤ
+ أأؤ
+ أأأؤ
+ أأأأ
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+ã LPAD(`ã`,5,'' )
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_lpad_ujis.result b/mysql-test/suite/jp/r/jp_lpad_ujis.result
new file mode 100644
index 00000000..c95f0e2f
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_lpad_ujis.result
@@ -0,0 +1,110 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+ أأأأ
+ أأأؤ
+ أأؤ
+ أؤ
+ ؤ
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+ أأأأ
+ أأأؤ
+ أأؤ
+ أؤ
+ ؤ
+
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+ã LPAD(`ã`,5,'' )
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+ã LPAD(`ã`,5,'')
+
+ ؤ
+ أؤ
+ أأؤ
+ أأأؤ
+ أأأأ
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+ã LPAD(`ã`,5,'' )
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_lpad_utf8.result b/mysql-test/suite/jp/r/jp_lpad_utf8.result
new file mode 100644
index 00000000..150dfe61
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_lpad_utf8.result
@@ -0,0 +1,110 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, LPAD(`C1`,5,'。') FROM `T1`;
+C1 LPAD(`C1`,5,'。')
+ 。。。。。
+ア 。。。。ア
+アイ 。。。アイ
+アイウ 。。アイウ
+アイウエ 。アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, LPAD(`C1`,5,'X') FROM `T2`;
+C1 LPAD(`C1`,5,'X')
+ XXXXX
+あ XXXXあ
+あい XXXあい
+あいう XXあいう
+あいうえ Xあいうえ
+あいうえお あいうえお
+SELECT `C1`, LPAD(`C1`,5,'丄') FROM `T3`;
+C1 LPAD(`C1`,5,'丄')
+ 丄丄丄丄丄
+龔 丄丄丄丄龔
+龔龖 丄丄丄龔龖
+龔龖龗 丄丄龔龖龗
+龔龖龗龞 丄龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, LPAD(`C1`,5,'。') FROM `T4`;
+C1 LPAD(`C1`,5,'。')
+ 。。。。。
+ア 。。。。ア
+アイ 。。。アイ
+アイウ 。。アイウ
+アイウエ 。アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, LPAD(`C1`,5,'X') FROM `T5`;
+C1 LPAD(`C1`,5,'X')
+ XXXXX
+あ XXXXあ
+あい XXXあい
+あいう XXあいう
+あいうえ Xあいうえ
+あいうえお あいうえお
+SELECT `C1`, LPAD(`C1`,5,'丄' ) FROM `T6`;
+C1 LPAD(`C1`,5,'丄' )
+ 丄丄丄丄丄
+龔 丄丄丄丄龔
+龔龖 丄丄丄龔龖
+龔龖龗 丄丄龔龖龗
+龔龖龗龞 丄龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, LPAD(`C1`,5,'。') FROM `T7`;
+C1 LPAD(`C1`,5,'。')
+アイウエオ アイウエオ
+アイウエ 。アイウエ
+アイウ 。。アイウ
+アイ 。。。アイ
+ア 。。。。ア
+ 。。。。。
+SELECT `C1`, LPAD(`C1`,5,'X') FROM `T8`;
+C1 LPAD(`C1`,5,'X')
+あいうえお あいうえお
+あいうえ Xあいうえ
+あいう XXあいう
+あい XXXあい
+あ XXXXあ
+ XXXXX
+SELECT `C1`, LPAD(`C1`,5,'丄' ) FROM `T9`;
+C1 LPAD(`C1`,5,'丄' )
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 丄龔龖龗龞
+龔龖龗 丄丄龔龖龗
+龔龖 丄丄丄龔龖
+龔 丄丄丄丄龔
+ 丄丄丄丄丄
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_ltrim_sjis.result b/mysql-test/suite/jp/r/jp_ltrim_sjis.result
new file mode 100644
index 00000000..7a7902af
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_ltrim_sjis.result
@@ -0,0 +1,173 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES ('@');
+INSERT INTO `sP` VALUES ('@@');
+INSERT INTO `sP` VALUES ('@@@');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES ('@');
+INSERT INTO `sQ` VALUES ('@@');
+INSERT INTO `sQ` VALUES ('@@@');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES (' \\\\\');
+INSERT INTO `sR` VALUES (' \\\\\');
+INSERT INTO `sR` VALUES (' \\\\\');
+INSERT INTO `sR` VALUES ('@\\\\\');
+INSERT INTO `sR` VALUES ('@@\\\\\');
+INSERT INTO `sR` VALUES ('@@@\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES ('@');
+INSERT INTO `sS` VALUES ('@@');
+INSERT INTO `sS` VALUES ('@@@');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES ('@');
+INSERT INTO `sT` VALUES ('@@');
+INSERT INTO `sT` VALUES ('@@@');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sU` VALUES (' \\\\\');
+INSERT INTO `sU` VALUES (' \\\\\');
+INSERT INTO `sU` VALUES (' \\\\\');
+INSERT INTO `sU` VALUES ('@\\\\\');
+INSERT INTO `sU` VALUES ('@@\\\\\');
+INSERT INTO `sU` VALUES ('@@@\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES ('@');
+INSERT INTO `sV` VALUES ('@@');
+INSERT INTO `sV` VALUES ('@@@');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES ('@');
+INSERT INTO `sW` VALUES ('@@');
+INSERT INTO `sW` VALUES ('@@@');
+INSERT INTO `sX` VALUES ('\\\\\');
+INSERT INTO `sX` VALUES (' \\\\\');
+INSERT INTO `sX` VALUES (' \\\\\');
+INSERT INTO `sX` VALUES (' \\\\\');
+INSERT INTO `sX` VALUES ('@\\\\\');
+INSERT INTO `sX` VALUES ('@@\\\\\');
+INSERT INTO `sX` VALUES ('@@@\\\\\');
+SELECT LTRIM(`bP`) from `sP`;
+LTRIM(`bP`)
+
+
+
+@@@
+@@
+@
+
+SELECT LTRIM(`bP`) from `sQ`;
+LTRIM(`bP`)
+
+
+
+@@@
+@@
+@
+
+SELECT LTRIM(`bP`) from `sR`;
+LTRIM(`bP`)
+\\\\\
+\\\\\
+\\\\\
+@@@\\\\\
+@@\\\\\
+@\\\\\
+\\\\\
+SELECT LTRIM(`bP`) from `sS`;
+LTRIM(`bP`)
+
+
+
+@@@
+@@
+@
+
+SELECT LTRIM(`bP`) from `sT`;
+LTRIM(`bP`)
+
+
+
+@@@
+@@
+@
+
+SELECT LTRIM(`bP`) from `sU`;
+LTRIM(`bP`)
+\\\\\
+\\\\\
+\\\\\
+@@@\\\\\
+@@\\\\\
+@\\\\\
+\\\\\
+SELECT LTRIM(`bP`) from `sV`;
+LTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT LTRIM(`bP`) from `sW`;
+LTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT LTRIM(`bP`) from `sX`;
+LTRIM(`bP`)
+\\\\\
+\\\\\
+\\\\\
+\\\\\
+@\\\\\
+@@\\\\\
+@@@\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_ltrim_ucs2.result b/mysql-test/suite/jp/r/jp_ltrim_ucs2.result
new file mode 100644
index 00000000..c46e917c
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_ltrim_ucs2.result
@@ -0,0 +1,174 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_ltrim_ujis.result b/mysql-test/suite/jp/r/jp_ltrim_ujis.result
new file mode 100644
index 00000000..f12444f2
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_ltrim_ujis.result
@@ -0,0 +1,173 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT LTRIM(`ã`) from `ԣ`;
+LTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_ltrim_utf8.result b/mysql-test/suite/jp/r/jp_ltrim_utf8.result
new file mode 100644
index 00000000..9ca8d61b
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_ltrim_utf8.result
@@ -0,0 +1,173 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES ('  アイウエオ');
+INSERT INTO `T1` VALUES ('   アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES ('  あいうえお');
+INSERT INTO `T2` VALUES ('   あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('  龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('   龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES ('  アイウエオ');
+INSERT INTO `T4` VALUES ('   アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES ('  あいうえお');
+INSERT INTO `T5` VALUES ('   あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('  龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('   龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES ('  アイウエオ');
+INSERT INTO `T7` VALUES ('   アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES ('  あいうえお');
+INSERT INTO `T8` VALUES ('   あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('  龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('   龔龖龗龞龡');
+SELECT LTRIM(`C1`) from `T1`;
+LTRIM(`C1`)
+アイウエオ
+アイウエオ
+アイウエオ
+   アイウエオ
+  アイウエオ
+ アイウエオ
+アイウエオ
+SELECT LTRIM(`C1`) from `T2`;
+LTRIM(`C1`)
+あいうえお
+あいうえお
+あいうえお
+   あいうえお
+  あいうえお
+ あいうえお
+あいうえお
+SELECT LTRIM(`C1`) from `T3`;
+LTRIM(`C1`)
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+   龔龖龗龞龡
+  龔龖龗龞龡
+ 龔龖龗龞龡
+龔龖龗龞龡
+SELECT LTRIM(`C1`) from `T4`;
+LTRIM(`C1`)
+アイウエオ
+アイウエオ
+アイウエオ
+   アイウエオ
+  アイウエオ
+ アイウエオ
+アイウエオ
+SELECT LTRIM(`C1`) from `T5`;
+LTRIM(`C1`)
+あいうえお
+あいうえお
+あいうえお
+   あいうえお
+  あいうえお
+ あいうえお
+あいうえお
+SELECT LTRIM(`C1`) from `T6`;
+LTRIM(`C1`)
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+   龔龖龗龞龡
+  龔龖龗龞龡
+ 龔龖龗龞龡
+龔龖龗龞龡
+SELECT LTRIM(`C1`) from `T7`;
+LTRIM(`C1`)
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ
+ アイウエオ
+  アイウエオ
+   アイウエオ
+SELECT LTRIM(`C1`) from `T8`;
+LTRIM(`C1`)
+あいうえお
+あいうえお
+あいうえお
+あいうえお
+ あいうえお
+  あいうえお
+   あいうえお
+SELECT LTRIM(`C1`) from `T9`;
+LTRIM(`C1`)
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+ 龔龖龗龞龡
+  龔龖龗龞龡
+   龔龖龗龞龡
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_ps_sjis.result b/mysql-test/suite/jp/r/jp_ps_sjis.result
new file mode 100644
index 00000000..0990b303
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_ps_sjis.result
@@ -0,0 +1,669 @@
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+DROP TABLE IF EXISTS t4;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = InnoDB;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = InnoDB;
+CREATE TABLE t3(
+`` char(1),
+`` char(1),
+`\` char(1)
+)DEFAULT CHARSET = sjis ENGINE = InnoDB;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = sjis ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('\');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('\');
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,10,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,10,?) FROM t1';
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+1
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+1
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x\
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+x
+
+\
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+2
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+2
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x\
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+x
+\
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+SET @arg = '\';
+EXECUTE stmt1 USING @arg;
+?
+\
+\
+\
+\
+\
+\
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+\xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+3
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+3
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+\\\\\\\xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+\\\
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx\\\\\\\
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+x
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MyISAM;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MyISAM;
+CREATE TABLE t3(
+`` char(1),
+`` char(1),
+`\` char(1)
+)DEFAULT CHARSET = sjis ENGINE = MyISAM;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = sjis ENGINE = MyISAM;
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('\');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('\' );
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,10,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,10,?) FROM t1';
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+1
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+1
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x\
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+x
+
+\
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+2
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+2
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x\
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+x
+\
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+SET @arg = '\';
+EXECUTE stmt1 USING @arg;
+?
+\
+\
+\
+\
+\
+\
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+\xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+3
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+3
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+\\\\\\\xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+\\\
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx\\\\\\\
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+x
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MEMORY;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MEMORY;
+CREATE TABLE t3(
+`` char(1),
+`` char(1),
+`\` char(1)
+)DEFAULT CHARSET = sjis ENGINE = MEMORY;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = sjis ENGINE =MEMORY;
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('\');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('\' );
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,10,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,10,?) FROM t1';
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+1
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+1
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x\
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+x
+
+\
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+2
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+2
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x\
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+x
+\
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+SET @arg = '\';
+EXECUTE stmt1 USING @arg;
+?
+\
+\
+\
+\
+\
+\
+EXECUTE stmt2 USING @arg;
+ \
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+sjis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+\xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+3
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+3
+EXECUTE stmt9 USING @arg;
+LPAD(c1,10,?)
+\\\\\\\xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+\\\
+EXECUTE stmt12 USING @arg;
+RPAD(c1,10,?)
+xxx\\\\\\\
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+x
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+\
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/jp/r/jp_ps_ujis.result b/mysql-test/suite/jp/r/jp_ps_ujis.result
new file mode 100644
index 00000000..d226b0ef
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_ps_ujis.result
@@ -0,0 +1,669 @@
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+DROP TABLE IF EXISTS t4;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
+CREATE TABLE t3(
+`` char(1),
+`` char(1),
+`` char(1)
+)DEFAULT CHARSET = ujis ENGINE = InnoDB;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('');
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+1
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+1
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+x
+
+
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+2
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+2
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+x
+
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+3
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+3
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+܏܏܏܏܏xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+܏܏
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx܏܏܏܏܏
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+x
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
+CREATE TABLE t3(
+`` char(1),
+`` char(1),
+`` char(1)
+)DEFAULT CHARSET = ujis ENGINE = MyISAM;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('' );
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+1
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+1
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+x
+
+
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+2
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+2
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+x
+
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+3
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+3
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+܏܏܏܏܏xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+܏܏
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx܏܏܏܏܏
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+x
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MEMORY;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MEMORY;
+CREATE TABLE t3(
+`` char(1),
+`` char(1),
+`` char(1)
+)DEFAULT CHARSET = ujis ENGINE = MEMORY;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE =MEMORY;
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('' );
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+1
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+1
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+x
+
+
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+2
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+2
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+x
+
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+?
+
+
+
+
+
+
+EXECUTE stmt2 USING @arg;
+
+x x x
+x x x
+y y y
+y y y
+z z z
+z z z
+EXECUTE stmt3 USING @arg;
+COUNT(*)
+6
+EXECUTE stmt4 USING @arg;
+CHAR_LENGTH(?)
+1
+EXECUTE stmt5 USING @arg;
+CHARSET(?)
+ujis
+EXECUTE stmt6 USING @arg;
+INSERT(c1,1,1,?)
+xx
+EXECUTE stmt7 USING @arg;
+INSTR(c1,?)
+3
+EXECUTE stmt8 USING @arg;
+LOCATE(?,c1)
+3
+EXECUTE stmt9 USING @arg;
+LPAD(c1,9,?)
+܏܏܏܏܏xxx
+EXECUTE stmt10 USING @arg;
+REPLACE(c1,?,'x')
+x
+EXECUTE stmt11 USING @arg;
+REPLACE(c1,'x',?)
+܏܏
+EXECUTE stmt12 USING @arg;
+RPAD(c1,9,?)
+xxx܏܏܏܏܏
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+x
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+c1
+
+
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/jp/r/jp_replace_sjis.result b/mysql-test/suite/jp/r/jp_replace_sjis.result
new file mode 100644
index 00000000..b8daf595
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_replace_sjis.result
@@ -0,0 +1,173 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+REPLACE(`bP`,'','')
+
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+REPLACE(`bP`,'\','\\')
+\\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_replace_ucs2.result b/mysql-test/suite/jp/r/jp_replace_ucs2.result
new file mode 100644
index 00000000..2390e88d
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_replace_ucs2.result
@@ -0,0 +1,174 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+REPLACE(`ã`,'','܏')
+܏܏ݏޏߏ
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+REPLACE(`ã`,'','ݏ')
+܏ݏݏޏߏ
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+REPLACE(`ã`,'','ޏ')
+܏ݏޏޏߏ
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+REPLACE(`ã`,'','ߏ')
+܏ݏޏߏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+܏ݏޏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+REPLACE(`ã`,'','܏')
+܏܏ݏޏߏ
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+REPLACE(`ã`,'','ݏ')
+܏ݏݏޏߏ
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+REPLACE(`ã`,'','ޏ')
+܏ݏޏޏߏ
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+REPLACE(`ã`,'','ߏ')
+܏ݏޏߏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+܏ݏޏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+REPLACE(`ã`,'','܏')
+܏܏ݏޏߏ
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+REPLACE(`ã`,'','ݏ')
+܏ݏݏޏߏ
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+REPLACE(`ã`,'','ޏ')
+܏ݏޏޏߏ
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+REPLACE(`ã`,'','ߏ')
+܏ݏޏߏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_replace_ujis.result b/mysql-test/suite/jp/r/jp_replace_ujis.result
new file mode 100644
index 00000000..b3ef6c28
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_replace_ujis.result
@@ -0,0 +1,173 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+REPLACE(`ã`,'','܏')
+܏܏ݏޏߏ
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+REPLACE(`ã`,'','ݏ')
+܏ݏݏޏߏ
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+REPLACE(`ã`,'','ޏ')
+܏ݏޏޏߏ
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+REPLACE(`ã`,'','ߏ')
+܏ݏޏߏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+܏ݏޏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+REPLACE(`ã`,'','܏')
+܏܏ݏޏߏ
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+REPLACE(`ã`,'','ݏ')
+܏ݏݏޏߏ
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+REPLACE(`ã`,'','ޏ')
+܏ݏޏޏߏ
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+REPLACE(`ã`,'','ߏ')
+܏ݏޏߏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+܏ݏޏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+REPLACE(`ã`,'','܏')
+܏܏ݏޏߏ
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+REPLACE(`ã`,'','ݏ')
+܏ݏݏޏߏ
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+REPLACE(`ã`,'','ޏ')
+܏ݏޏޏߏ
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+REPLACE(`ã`,'','ߏ')
+܏ݏޏߏߏ
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+REPLACE(`ã`,'','')
+܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_replace_utf8.result b/mysql-test/suite/jp/r/jp_replace_utf8.result
new file mode 100644
index 00000000..734e1e3d
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_replace_utf8.result
@@ -0,0 +1,173 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+SELECT REPLACE(`C1`,'ア','アア') FROM `T1`;
+REPLACE(`C1`,'ア','アア')
+アアイウエオ
+SELECT REPLACE(`C1`,'イ','イイ') FROM `T1`;
+REPLACE(`C1`,'イ','イイ')
+アイイウエオ
+SELECT REPLACE(`C1`,'ウ','ウウ') FROM `T1`;
+REPLACE(`C1`,'ウ','ウウ')
+アイウウエオ
+SELECT REPLACE(`C1`,'エ','エエ') FROM `T1`;
+REPLACE(`C1`,'エ','エエ')
+アイウエエオ
+SELECT REPLACE(`C1`,'オ','オオ') FROM `T1`;
+REPLACE(`C1`,'オ','オオ')
+アイウエオオ
+SELECT REPLACE(`C1`,'あ','ああ') FROM `T2`;
+REPLACE(`C1`,'あ','ああ')
+ああいうえお
+SELECT REPLACE(`C1`,'い','いい') FROM `T2`;
+REPLACE(`C1`,'い','いい')
+あいいうえお
+SELECT REPLACE(`C1`,'う','うう') FROM `T2`;
+REPLACE(`C1`,'う','うう')
+あいううえお
+SELECT REPLACE(`C1`,'え','ええ') FROM `T2`;
+REPLACE(`C1`,'え','ええ')
+あいうええお
+SELECT REPLACE(`C1`,'お','おお') FROM `T2`;
+REPLACE(`C1`,'お','おお')
+あいうえおお
+SELECT REPLACE(`C1`,'龔','龔龔') FROM `T3`;
+REPLACE(`C1`,'龔','龔龔')
+龔龔龖龗龞龡
+SELECT REPLACE(`C1`,'龖','龖龖') FROM `T3`;
+REPLACE(`C1`,'龖','龖龖')
+龔龖龖龗龞龡
+SELECT REPLACE(`C1`,'龗','龗龗') FROM `T3`;
+REPLACE(`C1`,'龗','龗龗')
+龔龖龗龗龞龡
+SELECT REPLACE(`C1`,'龞','龞龞') FROM `T3`;
+REPLACE(`C1`,'龞','龞龞')
+龔龖龗龞龞龡
+SELECT REPLACE(`C1`,'龡','龡龡') FROM `T3`;
+REPLACE(`C1`,'龡','龡龡')
+龔龖龗龞龡龡
+SELECT REPLACE(`C1`,'ア','アア') FROM `T4`;
+REPLACE(`C1`,'ア','アア')
+アアイウエオ
+SELECT REPLACE(`C1`,'イ','イイ') FROM `T4`;
+REPLACE(`C1`,'イ','イイ')
+アイイウエオ
+SELECT REPLACE(`C1`,'ウ','ウウ') FROM `T4`;
+REPLACE(`C1`,'ウ','ウウ')
+アイウウエオ
+SELECT REPLACE(`C1`,'エ','エエ') FROM `T4`;
+REPLACE(`C1`,'エ','エエ')
+アイウエエオ
+SELECT REPLACE(`C1`,'オ','オオ') FROM `T4`;
+REPLACE(`C1`,'オ','オオ')
+アイウエオオ
+SELECT REPLACE(`C1`,'あ','ああ') FROM `T5`;
+REPLACE(`C1`,'あ','ああ')
+ああいうえお
+SELECT REPLACE(`C1`,'い','いい') FROM `T5`;
+REPLACE(`C1`,'い','いい')
+あいいうえお
+SELECT REPLACE(`C1`,'う','うう') FROM `T5`;
+REPLACE(`C1`,'う','うう')
+あいううえお
+SELECT REPLACE(`C1`,'え','ええ') FROM `T5`;
+REPLACE(`C1`,'え','ええ')
+あいうええお
+SELECT REPLACE(`C1`,'お','おお') FROM `T5`;
+REPLACE(`C1`,'お','おお')
+あいうえおお
+SELECT REPLACE(`C1`,'龔','龔龔') FROM `T6`;
+REPLACE(`C1`,'龔','龔龔')
+龔龔龖龗龞龡
+SELECT REPLACE(`C1`,'龖','龖龖') FROM `T6`;
+REPLACE(`C1`,'龖','龖龖')
+龔龖龖龗龞龡
+SELECT REPLACE(`C1`,'龗','龗龗') FROM `T6`;
+REPLACE(`C1`,'龗','龗龗')
+龔龖龗龗龞龡
+SELECT REPLACE(`C1`,'龞','龞龞') FROM `T6`;
+REPLACE(`C1`,'龞','龞龞')
+龔龖龗龞龞龡
+SELECT REPLACE(`C1`,'龡','龡龡') FROM `T6`;
+REPLACE(`C1`,'龡','龡龡')
+龔龖龗龞龡龡
+SELECT REPLACE(`C1`,'ア','アア') FROM `T7`;
+REPLACE(`C1`,'ア','アア')
+アアイウエオ
+SELECT REPLACE(`C1`,'イ','イイ') FROM `T7`;
+REPLACE(`C1`,'イ','イイ')
+アイイウエオ
+SELECT REPLACE(`C1`,'ウ','ウウ') FROM `T7`;
+REPLACE(`C1`,'ウ','ウウ')
+アイウウエオ
+SELECT REPLACE(`C1`,'エ','エエ') FROM `T7`;
+REPLACE(`C1`,'エ','エエ')
+アイウエエオ
+SELECT REPLACE(`C1`,'オ','オオ') FROM `T7`;
+REPLACE(`C1`,'オ','オオ')
+アイウエオオ
+SELECT REPLACE(`C1`,'あ','ああ') FROM `T8`;
+REPLACE(`C1`,'あ','ああ')
+ああいうえお
+SELECT REPLACE(`C1`,'い','いい') FROM `T8`;
+REPLACE(`C1`,'い','いい')
+あいいうえお
+SELECT REPLACE(`C1`,'う','うう') FROM `T8`;
+REPLACE(`C1`,'う','うう')
+あいううえお
+SELECT REPLACE(`C1`,'え','ええ') FROM `T8`;
+REPLACE(`C1`,'え','ええ')
+あいうええお
+SELECT REPLACE(`C1`,'お','おお') FROM `T8`;
+REPLACE(`C1`,'お','おお')
+あいうえおお
+SELECT REPLACE(`C1`,'龔','龔龔') FROM `T9`;
+REPLACE(`C1`,'龔','龔龔')
+龔龔龖龗龞龡
+SELECT REPLACE(`C1`,'龖','龖龖') FROM `T9`;
+REPLACE(`C1`,'龖','龖龖')
+龔龖龖龗龞龡
+SELECT REPLACE(`C1`,'龗','龗龗') FROM `T9`;
+REPLACE(`C1`,'龗','龗龗')
+龔龖龗龗龞龡
+SELECT REPLACE(`C1`,'龞','龞龞') FROM `T9`;
+REPLACE(`C1`,'龞','龞龞')
+龔龖龗龞龞龡
+SELECT REPLACE(`C1`,'龡','龡龡') FROM `T9`;
+REPLACE(`C1`,'龡','龡龡')
+龔龖龗龞龡龡
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_reverse_sjis.result b/mysql-test/suite/jp/r/jp_reverse_sjis.result
new file mode 100644
index 00000000..95c8cb76
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_reverse_sjis.result
@@ -0,0 +1,65 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+SELECT REVERSE(`bP`) FROM `sP`;
+REVERSE(`bP`)
+
+SELECT REVERSE(`bP`) FROM `sQ`;
+REVERSE(`bP`)
+
+SELECT REVERSE(`bP`) FROM `sR`;
+REVERSE(`bP`)
+\\\\\
+SELECT REVERSE(`bP`) FROM `sS`;
+REVERSE(`bP`)
+
+SELECT REVERSE(`bP`) FROM `sT`;
+REVERSE(`bP`)
+
+SELECT REVERSE(`bP`) FROM `sU`;
+REVERSE(`bP`)
+\\\\\
+SELECT REVERSE(`bP`) FROM `sV`;
+REVERSE(`bP`)
+
+SELECT REVERSE(`bP`) FROM `sW`;
+REVERSE(`bP`)
+
+SELECT REVERSE(`bP`) FROM `sX`;
+REVERSE(`bP`)
+\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_reverse_ucs2.result b/mysql-test/suite/jp/r/jp_reverse_ucs2.result
new file mode 100644
index 00000000..9da7f5d7
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_reverse_ucs2.result
@@ -0,0 +1,66 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+ߏޏݏ
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+ߏޏݏ
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+ߏޏݏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_reverse_ujis.result b/mysql-test/suite/jp/r/jp_reverse_ujis.result
new file mode 100644
index 00000000..67ba5a10
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_reverse_ujis.result
@@ -0,0 +1,65 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+ߏޏݏ
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+ߏޏݏ
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+
+SELECT REVERSE(`ã`) FROM `ԣ`;
+REVERSE(`ã`)
+ߏޏݏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_reverse_utf8.result b/mysql-test/suite/jp/r/jp_reverse_utf8.result
new file mode 100644
index 00000000..8ff7afb7
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_reverse_utf8.result
@@ -0,0 +1,65 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+SELECT REVERSE(`C1`) FROM `T1`;
+REVERSE(`C1`)
+オエウイア
+SELECT REVERSE(`C1`) FROM `T2`;
+REVERSE(`C1`)
+おえういあ
+SELECT REVERSE(`C1`) FROM `T3`;
+REVERSE(`C1`)
+龡龞龗龖龔
+SELECT REVERSE(`C1`) FROM `T4`;
+REVERSE(`C1`)
+オエウイア
+SELECT REVERSE(`C1`) FROM `T5`;
+REVERSE(`C1`)
+おえういあ
+SELECT REVERSE(`C1`) FROM `T6`;
+REVERSE(`C1`)
+龡龞龗龖龔
+SELECT REVERSE(`C1`) FROM `T7`;
+REVERSE(`C1`)
+オエウイア
+SELECT REVERSE(`C1`) FROM `T8`;
+REVERSE(`C1`)
+おえういあ
+SELECT REVERSE(`C1`) FROM `T9`;
+REVERSE(`C1`)
+龡龞龗龖龔
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_right_sjis.result b/mysql-test/suite/jp/r/jp_right_sjis.result
new file mode 100644
index 00000000..332f8b07
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_right_sjis.result
@@ -0,0 +1,470 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, RIGHT(`bP`,0) FROM `sP`;
+bP RIGHT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sP`;
+bP RIGHT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sP`;
+bP RIGHT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sP`;
+bP RIGHT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sP`;
+bP RIGHT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sP`;
+bP RIGHT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,0) FROM `sQ`;
+bP RIGHT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sQ`;
+bP RIGHT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sQ`;
+bP RIGHT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sQ`;
+bP RIGHT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sQ`;
+bP RIGHT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sQ`;
+bP RIGHT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,0) FROM `sR`;
+bP RIGHT(`bP`,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, RIGHT(`bP`,1) FROM `sR`;
+bP RIGHT(`bP`,1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, RIGHT(`bP`,2) FROM `sR`;
+bP RIGHT(`bP`,2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, RIGHT(`bP`,3) FROM `sR`;
+bP RIGHT(`bP`,3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, RIGHT(`bP`,4) FROM `sR`;
+bP RIGHT(`bP`,4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, RIGHT(`bP`,5) FROM `sR`;
+bP RIGHT(`bP`,5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, RIGHT(`bP`,0) FROM `sS`;
+bP RIGHT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sS`;
+bP RIGHT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sS`;
+bP RIGHT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sS`;
+bP RIGHT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sS`;
+bP RIGHT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sS`;
+bP RIGHT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,0) FROM `sT`;
+bP RIGHT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sT`;
+bP RIGHT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sT`;
+bP RIGHT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sT`;
+bP RIGHT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sT`;
+bP RIGHT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sT`;
+bP RIGHT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,0) FROM `sU`;
+bP RIGHT(`bP`,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, RIGHT(`bP`,1) FROM `sU`;
+bP RIGHT(`bP`,1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, RIGHT(`bP`,2) FROM `sU`;
+bP RIGHT(`bP`,2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, RIGHT(`bP`,3) FROM `sU`;
+bP RIGHT(`bP`,3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, RIGHT(`bP`,4) FROM `sU`;
+bP RIGHT(`bP`,4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, RIGHT(`bP`,5) FROM `sU`;
+bP RIGHT(`bP`,5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, RIGHT(`bP`,0) FROM `sV`;
+bP RIGHT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sV`;
+bP RIGHT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sV`;
+bP RIGHT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sV`;
+bP RIGHT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sV`;
+bP RIGHT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sV`;
+bP RIGHT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,0) FROM `sW`;
+bP RIGHT(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sW`;
+bP RIGHT(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sW`;
+bP RIGHT(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sW`;
+bP RIGHT(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sW`;
+bP RIGHT(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sW`;
+bP RIGHT(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, RIGHT(`bP`,0) FROM `sX`;
+bP RIGHT(`bP`,0)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, RIGHT(`bP`,1) FROM `sX`;
+bP RIGHT(`bP`,1)
+\\\\\ \
+\\\\ \
+\\\ \
+\\ \
+\ \
+
+SELECT `bP`, RIGHT(`bP`,2) FROM `sX`;
+bP RIGHT(`bP`,2)
+\\\\\ \\
+\\\\ \\
+\\\ \\
+\\ \\
+\ \
+
+SELECT `bP`, RIGHT(`bP`,3) FROM `sX`;
+bP RIGHT(`bP`,3)
+\\\\\ \\\
+\\\\ \\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, RIGHT(`bP`,4) FROM `sX`;
+bP RIGHT(`bP`,4)
+\\\\\ \\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, RIGHT(`bP`,5) FROM `sX`;
+bP RIGHT(`bP`,5)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_right_ucs2.result b/mysql-test/suite/jp/r/jp_right_ucs2.result
new file mode 100644
index 00000000..e2e594b9
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_right_ucs2.result
@@ -0,0 +1,471 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+܏ݏޏߏ ߏ
+܏ݏޏ ޏ
+܏ݏ ݏ
+܏ ܏
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+܏ݏޏߏ ޏߏ
+܏ݏޏ ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+܏ݏޏߏ ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_right_ujis.result b/mysql-test/suite/jp/r/jp_right_ujis.result
new file mode 100644
index 00000000..d5d2cda0
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_right_ujis.result
@@ -0,0 +1,470 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+܏ ܏
+܏ݏ ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+ã RIGHT(`ã`,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+ã RIGHT(`ã`,1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+ã RIGHT(`ã`,2)
+܏ݏޏߏ ߏ
+܏ݏޏ ޏ
+܏ݏ ݏ
+܏ ܏
+
+
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+ã RIGHT(`ã`,3)
+܏ݏޏߏ ޏߏ
+܏ݏޏ ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+ã RIGHT(`ã`,4)
+܏ݏޏߏ ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+ã RIGHT(`ã`,5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_right_utf8.result b/mysql-test/suite/jp/r/jp_right_utf8.result
new file mode 100644
index 00000000..e0b5c847
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_right_utf8.result
@@ -0,0 +1,470 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, RIGHT(`C1`,0) FROM `T1`;
+C1 RIGHT(`C1`,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, RIGHT(`C1`,1) FROM `T1`;
+C1 RIGHT(`C1`,1)
+
+ア ア
+アイ イ
+アイウ ウ
+アイウエ エ
+アイウエオ オ
+SELECT `C1`, RIGHT(`C1`,2) FROM `T1`;
+C1 RIGHT(`C1`,2)
+
+ア ア
+アイ アイ
+アイウ イウ
+アイウエ ウエ
+アイウエオ エオ
+SELECT `C1`, RIGHT(`C1`,3) FROM `T1`;
+C1 RIGHT(`C1`,3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ イウエ
+アイウエオ ウエオ
+SELECT `C1`, RIGHT(`C1`,4) FROM `T1`;
+C1 RIGHT(`C1`,4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ イウエオ
+SELECT `C1`, RIGHT(`C1`,5) FROM `T1`;
+C1 RIGHT(`C1`,5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, RIGHT(`C1`,0) FROM `T2`;
+C1 RIGHT(`C1`,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, RIGHT(`C1`,1) FROM `T2`;
+C1 RIGHT(`C1`,1)
+
+あ あ
+あい い
+あいう う
+あいうえ え
+あいうえお お
+SELECT `C1`, RIGHT(`C1`,2) FROM `T2`;
+C1 RIGHT(`C1`,2)
+
+あ あ
+あい あい
+あいう いう
+あいうえ うえ
+あいうえお えお
+SELECT `C1`, RIGHT(`C1`,3) FROM `T2`;
+C1 RIGHT(`C1`,3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ いうえ
+あいうえお うえお
+SELECT `C1`, RIGHT(`C1`,4) FROM `T2`;
+C1 RIGHT(`C1`,4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお いうえお
+SELECT `C1`, RIGHT(`C1`,5) FROM `T2`;
+C1 RIGHT(`C1`,5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, RIGHT(`C1`,0) FROM `T3`;
+C1 RIGHT(`C1`,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, RIGHT(`C1`,1) FROM `T3`;
+C1 RIGHT(`C1`,1)
+
+龔 龔
+龔龖 龖
+龔龖龗 龗
+龔龖龗龞 龞
+龔龖龗龞龡 龡
+SELECT `C1`, RIGHT(`C1`,2) FROM `T3`;
+C1 RIGHT(`C1`,2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龖龗
+龔龖龗龞 龗龞
+龔龖龗龞龡 龞龡
+SELECT `C1`, RIGHT(`C1`,3) FROM `T3`;
+C1 RIGHT(`C1`,3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龖龗龞
+龔龖龗龞龡 龗龞龡
+SELECT `C1`, RIGHT(`C1`,4) FROM `T3`;
+C1 RIGHT(`C1`,4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龖龗龞龡
+SELECT `C1`, RIGHT(`C1`,5) FROM `T3`;
+C1 RIGHT(`C1`,5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, RIGHT(`C1`,0) FROM `T4`;
+C1 RIGHT(`C1`,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, RIGHT(`C1`,1) FROM `T4`;
+C1 RIGHT(`C1`,1)
+
+ア ア
+アイ イ
+アイウ ウ
+アイウエ エ
+アイウエオ オ
+SELECT `C1`, RIGHT(`C1`,2) FROM `T4`;
+C1 RIGHT(`C1`,2)
+
+ア ア
+アイ アイ
+アイウ イウ
+アイウエ ウエ
+アイウエオ エオ
+SELECT `C1`, RIGHT(`C1`,3) FROM `T4`;
+C1 RIGHT(`C1`,3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ イウエ
+アイウエオ ウエオ
+SELECT `C1`, RIGHT(`C1`,4) FROM `T4`;
+C1 RIGHT(`C1`,4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ イウエオ
+SELECT `C1`, RIGHT(`C1`,5) FROM `T4`;
+C1 RIGHT(`C1`,5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, RIGHT(`C1`,0) FROM `T5`;
+C1 RIGHT(`C1`,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, RIGHT(`C1`,1) FROM `T5`;
+C1 RIGHT(`C1`,1)
+
+あ あ
+あい い
+あいう う
+あいうえ え
+あいうえお お
+SELECT `C1`, RIGHT(`C1`,2) FROM `T5`;
+C1 RIGHT(`C1`,2)
+
+あ あ
+あい あい
+あいう いう
+あいうえ うえ
+あいうえお えお
+SELECT `C1`, RIGHT(`C1`,3) FROM `T5`;
+C1 RIGHT(`C1`,3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ いうえ
+あいうえお うえお
+SELECT `C1`, RIGHT(`C1`,4) FROM `T5`;
+C1 RIGHT(`C1`,4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお いうえお
+SELECT `C1`, RIGHT(`C1`,5) FROM `T5`;
+C1 RIGHT(`C1`,5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, RIGHT(`C1`,0) FROM `T6`;
+C1 RIGHT(`C1`,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, RIGHT(`C1`,1) FROM `T6`;
+C1 RIGHT(`C1`,1)
+
+龔 龔
+龔龖 龖
+龔龖龗 龗
+龔龖龗龞 龞
+龔龖龗龞龡 龡
+SELECT `C1`, RIGHT(`C1`,2) FROM `T6`;
+C1 RIGHT(`C1`,2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龖龗
+龔龖龗龞 龗龞
+龔龖龗龞龡 龞龡
+SELECT `C1`, RIGHT(`C1`,3) FROM `T6`;
+C1 RIGHT(`C1`,3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龖龗龞
+龔龖龗龞龡 龗龞龡
+SELECT `C1`, RIGHT(`C1`,4) FROM `T6`;
+C1 RIGHT(`C1`,4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龖龗龞龡
+SELECT `C1`, RIGHT(`C1`,5) FROM `T6`;
+C1 RIGHT(`C1`,5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, RIGHT(`C1`,0) FROM `T7`;
+C1 RIGHT(`C1`,0)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, RIGHT(`C1`,1) FROM `T7`;
+C1 RIGHT(`C1`,1)
+アイウエオ オ
+アイウエ エ
+アイウ ウ
+アイ イ
+ア ア
+
+SELECT `C1`, RIGHT(`C1`,2) FROM `T7`;
+C1 RIGHT(`C1`,2)
+アイウエオ エオ
+アイウエ ウエ
+アイウ イウ
+アイ アイ
+ア ア
+
+SELECT `C1`, RIGHT(`C1`,3) FROM `T7`;
+C1 RIGHT(`C1`,3)
+アイウエオ ウエオ
+アイウエ イウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, RIGHT(`C1`,4) FROM `T7`;
+C1 RIGHT(`C1`,4)
+アイウエオ イウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, RIGHT(`C1`,5) FROM `T7`;
+C1 RIGHT(`C1`,5)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, RIGHT(`C1`,0) FROM `T8`;
+C1 RIGHT(`C1`,0)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, RIGHT(`C1`,1) FROM `T8`;
+C1 RIGHT(`C1`,1)
+あいうえお お
+あいうえ え
+あいう う
+あい い
+あ あ
+
+SELECT `C1`, RIGHT(`C1`,2) FROM `T8`;
+C1 RIGHT(`C1`,2)
+あいうえお えお
+あいうえ うえ
+あいう いう
+あい あい
+あ あ
+
+SELECT `C1`, RIGHT(`C1`,3) FROM `T8`;
+C1 RIGHT(`C1`,3)
+あいうえお うえお
+あいうえ いうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, RIGHT(`C1`,4) FROM `T8`;
+C1 RIGHT(`C1`,4)
+あいうえお いうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, RIGHT(`C1`,5) FROM `T8`;
+C1 RIGHT(`C1`,5)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, RIGHT(`C1`,0) FROM `T9`;
+C1 RIGHT(`C1`,0)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, RIGHT(`C1`,1) FROM `T9`;
+C1 RIGHT(`C1`,1)
+龔龖龗龞龡 龡
+龔龖龗龞 龞
+龔龖龗 龗
+龔龖 龖
+龔 龔
+
+SELECT `C1`, RIGHT(`C1`,2) FROM `T9`;
+C1 RIGHT(`C1`,2)
+龔龖龗龞龡 龞龡
+龔龖龗龞 龗龞
+龔龖龗 龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, RIGHT(`C1`,3) FROM `T9`;
+C1 RIGHT(`C1`,3)
+龔龖龗龞龡 龗龞龡
+龔龖龗龞 龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, RIGHT(`C1`,4) FROM `T9`;
+C1 RIGHT(`C1`,4)
+龔龖龗龞龡 龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, RIGHT(`C1`,5) FROM `T9`;
+C1 RIGHT(`C1`,5)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_rpad_sjis.result b/mysql-test/suite/jp/r/jp_rpad_sjis.result
new file mode 100644
index 00000000..906bbc46
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rpad_sjis.result
@@ -0,0 +1,110 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, RPAD(`bP`,5,'') FROM `sP`;
+bP RPAD(`bP`,5,'')
+
+
+
+
+
+
+SELECT `bP`, RPAD(`bP`,5,'w') FROM `sQ`;
+bP RPAD(`bP`,5,'w')
+ wwwww
+ wwww
+ www
+ ww
+ w
+
+SELECT `bP`, RPAD(`bP`,5,'\') FROM `sR`;
+bP RPAD(`bP`,5,'\')
+ \\\\\
+\ \\\\\
+\\ \\\\\
+\\\ \\\\\
+\\\\ \\\\\
+\\\\\ \\\\\
+SELECT `bP`, RPAD(`bP`,5,'') FROM `sS`;
+bP RPAD(`bP`,5,'')
+
+
+
+
+
+
+SELECT `bP`, RPAD(`bP`,5,'w') FROM `sT`;
+bP RPAD(`bP`,5,'w')
+ wwwww
+ wwww
+ www
+ ww
+ w
+
+SELECT `bP`, RPAD(`bP`,5,'\' ) FROM `sU`;
+bP RPAD(`bP`,5,'\' )
+ \\\\\
+\ \\\\\
+\\ \\\\\
+\\\ \\\\\
+\\\\ \\\\\
+\\\\\ \\\\\
+SELECT `bP`, RPAD(`bP`,5,'') FROM `sV`;
+bP RPAD(`bP`,5,'')
+
+
+
+
+
+
+SELECT `bP`, RPAD(`bP`,5,'w') FROM `sW`;
+bP RPAD(`bP`,5,'w')
+
+ w
+ ww
+ www
+ wwww
+ wwwww
+SELECT `bP`, RPAD(`bP`,5,'\' ) FROM `sX`;
+bP RPAD(`bP`,5,'\' )
+\\\\\ \\\\\
+\\\\ \\\\\
+\\\ \\\\\
+\\ \\\\\
+\ \\\\\
+ \\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_rpad_ucs2.result b/mysql-test/suite/jp/r/jp_rpad_ucs2.result
new file mode 100644
index 00000000..c3cbd154
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rpad_ucs2.result
@@ -0,0 +1,111 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+ أأأأ
+ أأأ
+ أأ
+ أ
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+ ܏
+܏ ܏ݏ
+܏ݏ ܏ݏޏ
+܏ݏޏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+ أأأأ
+ أأأ
+ أأ
+ أ
+
+
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+ã RPAD(`ã`,5,'' )
+
+ ܏
+܏ ܏ݏ
+܏ݏ ܏ݏޏ
+܏ݏޏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+ أ
+ أأ
+ أأأ
+ أأأأ
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+ã RPAD(`ã`,5,'' )
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏߏ
+܏ݏ ܏ݏޏ
+܏ ܏ݏ
+ ܏
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_rpad_ujis.result b/mysql-test/suite/jp/r/jp_rpad_ujis.result
new file mode 100644
index 00000000..38beef83
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rpad_ujis.result
@@ -0,0 +1,110 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+ أأأأ
+ أأأ
+ أأ
+ أ
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+ ܏
+܏ ܏ݏ
+܏ݏ ܏ݏޏ
+܏ݏޏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+ أأأأ
+ أأأ
+ أأ
+ أ
+
+
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+ã RPAD(`ã`,5,'' )
+
+ ܏
+܏ ܏ݏ
+܏ݏ ܏ݏޏ
+܏ݏޏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+
+
+
+
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+ã RPAD(`ã`,5,'')
+
+
+ أ
+ أأ
+ أأأ
+ أأأأ
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+ã RPAD(`ã`,5,'' )
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏߏ
+܏ݏ ܏ݏޏ
+܏ ܏ݏ
+ ܏
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_rpad_utf8.result b/mysql-test/suite/jp/r/jp_rpad_utf8.result
new file mode 100644
index 00000000..c2d65a3c
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rpad_utf8.result
@@ -0,0 +1,110 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, RPAD(`C1`,5,'。') FROM `T1`;
+C1 RPAD(`C1`,5,'。')
+ 。。。。。
+ア ア。。。。
+アイ アイ。。。
+アイウ アイウ。。
+アイウエ アイウエ。
+アイウエオ アイウエオ
+SELECT `C1`, RPAD(`C1`,5,'X') FROM `T2`;
+C1 RPAD(`C1`,5,'X')
+ XXXXX
+あ あXXXX
+あい あいXXX
+あいう あいうXX
+あいうえ あいうえX
+あいうえお あいうえお
+SELECT `C1`, RPAD(`C1`,5,'丄') FROM `T3`;
+C1 RPAD(`C1`,5,'丄')
+ 丄丄丄丄丄
+龔 龔丄丄丄丄
+龔龖 龔龖丄丄丄
+龔龖龗 龔龖龗丄丄
+龔龖龗龞 龔龖龗龞丄
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, RPAD(`C1`,5,'。') FROM `T4`;
+C1 RPAD(`C1`,5,'。')
+ 。。。。。
+ア ア。。。。
+アイ アイ。。。
+アイウ アイウ。。
+アイウエ アイウエ。
+アイウエオ アイウエオ
+SELECT `C1`, RPAD(`C1`,5,'X') FROM `T5`;
+C1 RPAD(`C1`,5,'X')
+ XXXXX
+あ あXXXX
+あい あいXXX
+あいう あいうXX
+あいうえ あいうえX
+あいうえお あいうえお
+SELECT `C1`, RPAD(`C1`,5,'丄' ) FROM `T6`;
+C1 RPAD(`C1`,5,'丄' )
+ 丄丄丄丄丄
+龔 龔丄丄丄丄
+龔龖 龔龖丄丄丄
+龔龖龗 龔龖龗丄丄
+龔龖龗龞 龔龖龗龞丄
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, RPAD(`C1`,5,'。') FROM `T7`;
+C1 RPAD(`C1`,5,'。')
+アイウエオ アイウエオ
+アイウエ アイウエ。
+アイウ アイウ。。
+アイ アイ。。。
+ア ア。。。。
+ 。。。。。
+SELECT `C1`, RPAD(`C1`,5,'X') FROM `T8`;
+C1 RPAD(`C1`,5,'X')
+あいうえお あいうえお
+あいうえ あいうえX
+あいう あいうXX
+あい あいXXX
+あ あXXXX
+ XXXXX
+SELECT `C1`, RPAD(`C1`,5,'丄' ) FROM `T9`;
+C1 RPAD(`C1`,5,'丄' )
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞丄
+龔龖龗 龔龖龗丄丄
+龔龖 龔龖丄丄丄
+龔 龔丄丄丄丄
+ 丄丄丄丄丄
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_rtrim_sjis.result b/mysql-test/suite/jp/r/jp_rtrim_sjis.result
new file mode 100644
index 00000000..fc5b490a
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rtrim_sjis.result
@@ -0,0 +1,173 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES ('@');
+INSERT INTO `sP` VALUES ('@@');
+INSERT INTO `sP` VALUES ('@@@');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES ('@');
+INSERT INTO `sQ` VALUES ('@@');
+INSERT INTO `sQ` VALUES ('@@@');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\ ');
+INSERT INTO `sR` VALUES ('\\\\\ ');
+INSERT INTO `sR` VALUES ('\\\\\ ');
+INSERT INTO `sR` VALUES ('\\\\\@');
+INSERT INTO `sR` VALUES ('\\\\\@@');
+INSERT INTO `sR` VALUES ('\\\\\@@@');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES ('@');
+INSERT INTO `sS` VALUES ('@@');
+INSERT INTO `sS` VALUES ('@@@');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES ('@');
+INSERT INTO `sT` VALUES ('@@');
+INSERT INTO `sT` VALUES ('@@@');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sU` VALUES ('\\\\\ ');
+INSERT INTO `sU` VALUES ('\\\\\ ');
+INSERT INTO `sU` VALUES ('\\\\\ ');
+INSERT INTO `sU` VALUES ('\\\\\@');
+INSERT INTO `sU` VALUES ('\\\\\@@');
+INSERT INTO `sU` VALUES ('\\\\\@@@');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES ('@');
+INSERT INTO `sV` VALUES ('@@');
+INSERT INTO `sV` VALUES ('@@@');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES ('@');
+INSERT INTO `sW` VALUES ('@@');
+INSERT INTO `sW` VALUES ('@@@');
+INSERT INTO `sX` VALUES ('\\\\\');
+INSERT INTO `sX` VALUES ('\\\\\ ');
+INSERT INTO `sX` VALUES ('\\\\\ ');
+INSERT INTO `sX` VALUES ('\\\\\ ');
+INSERT INTO `sX` VALUES ('\\\\\@');
+INSERT INTO `sX` VALUES ('\\\\\@@');
+INSERT INTO `sX` VALUES ('\\\\\@@@');
+SELECT RTRIM(`bP`) from `sP`;
+RTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT RTRIM(`bP`) from `sQ`;
+RTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT RTRIM(`bP`) from `sR`;
+RTRIM(`bP`)
+\\\\\
+\\\\\
+\\\\\
+\\\\\
+\\\\\@
+\\\\\@@
+\\\\\@@@
+SELECT RTRIM(`bP`) from `sS`;
+RTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT RTRIM(`bP`) from `sT`;
+RTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT RTRIM(`bP`) from `sU`;
+RTRIM(`bP`)
+\\\\\
+\\\\\
+\\\\\
+\\\\\
+\\\\\@
+\\\\\@@
+\\\\\@@@
+SELECT RTRIM(`bP`) from `sV`;
+RTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT RTRIM(`bP`) from `sW`;
+RTRIM(`bP`)
+
+
+
+
+@
+@@
+@@@
+SELECT RTRIM(`bP`) from `sX`;
+RTRIM(`bP`)
+\\\\\
+\\\\\
+\\\\\
+\\\\\
+\\\\\@
+\\\\\@@
+\\\\\@@@
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_rtrim_ucs2.result b/mysql-test/suite/jp/r/jp_rtrim_ucs2.result
new file mode 100644
index 00000000..41739635
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rtrim_ucs2.result
@@ -0,0 +1,174 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_rtrim_ujis.result b/mysql-test/suite/jp/r/jp_rtrim_ujis.result
new file mode 100644
index 00000000..d922cab9
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rtrim_ujis.result
@@ -0,0 +1,173 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+
+
+
+
+
+
+
+SELECT RTRIM(`ã`) from `ԣ`;
+RTRIM(`ã`)
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+܏ݏޏߏࡡ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_rtrim_utf8.result b/mysql-test/suite/jp/r/jp_rtrim_utf8.result
new file mode 100644
index 00000000..d793f895
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_rtrim_utf8.result
@@ -0,0 +1,173 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ  ');
+INSERT INTO `T1` VALUES ('アイウエオ   ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお  ');
+INSERT INTO `T2` VALUES ('あいうえお   ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡  ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡   ');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ  ');
+INSERT INTO `T4` VALUES ('アイウエオ   ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお  ');
+INSERT INTO `T5` VALUES ('あいうえお   ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡  ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡   ');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ  ');
+INSERT INTO `T7` VALUES ('アイウエオ   ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお  ');
+INSERT INTO `T8` VALUES ('あいうえお   ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡  ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡   ');
+SELECT RTRIM(`C1`) from `T1`;
+RTRIM(`C1`)
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ 
+アイウエオ  
+アイウエオ   
+SELECT RTRIM(`C1`) from `T2`;
+RTRIM(`C1`)
+あいうえお
+あいうえお
+あいうえお
+あいうえお
+あいうえお 
+あいうえお  
+あいうえお   
+SELECT RTRIM(`C1`) from `T3`;
+RTRIM(`C1`)
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡 
+龔龖龗龞龡  
+龔龖龗龞龡   
+SELECT RTRIM(`C1`) from `T4`;
+RTRIM(`C1`)
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ 
+アイウエオ  
+アイウエオ   
+SELECT RTRIM(`C1`) from `T5`;
+RTRIM(`C1`)
+あいうえお
+あいうえお
+あいうえお
+あいうえお
+あいうえお 
+あいうえお  
+あいうえお   
+SELECT RTRIM(`C1`) from `T6`;
+RTRIM(`C1`)
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡 
+龔龖龗龞龡  
+龔龖龗龞龡   
+SELECT RTRIM(`C1`) from `T7`;
+RTRIM(`C1`)
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ
+アイウエオ 
+アイウエオ  
+アイウエオ   
+SELECT RTRIM(`C1`) from `T8`;
+RTRIM(`C1`)
+あいうえお
+あいうえお
+あいうえお
+あいうえお
+あいうえお 
+あいうえお  
+あいうえお   
+SELECT RTRIM(`C1`) from `T9`;
+RTRIM(`C1`)
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡
+龔龖龗龞龡 
+龔龖龗龞龡  
+龔龖龗龞龡   
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_select_sjis.result b/mysql-test/suite/jp/r/jp_select_sjis.result
new file mode 100644
index 00000000..38c1cf06
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_select_sjis.result
@@ -0,0 +1,287 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+SELECT * FROM `sP`;
+bP
+ !"#$%&'()*+,-./
+
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+abcdefghijklmno
+PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~
+
+
+
+SELECT * FROM `sQ`;
+bP
+@@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE
+EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@
+EEEEEE
+E
+E@ABCDEFGHIJKLMNOPQR
+E
+E@ABCDEFGHIJKLMNOPQR
+E
+E
+E@ABCDEFGHIJKLMNOPQR
+E
+E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{]}~
+EEEEE
+ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE
+EEEEEEEEE
+‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+EEEEEEEEEEEEE
+EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE
+{|}~
+EEEEEEEEEEEEEEEEEE
+EEEEEEE
+ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈
+EEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE
+˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ
+EEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+ꞁEEEEE
+SELECT * FROM `sR`;
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sS`;
+bP
+ !"#$%&'()*+,-./
+
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+abcdefghijklmno
+PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~
+
+
+
+SELECT * FROM `sT`;
+bP
+@@ABCDEFGHIJKLMNOPQR
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEOPQR
+EEEEEEEEEpqrstuvwxyz
+EEEEEEEEEEEE
+EEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE
+EEEEEEEEEE@
+EEEEEE
+E
+E@ABCDEFGHIJKLMNOPQR
+E
+E@ABCDEFGHIJKLMNOPQR
+E
+E
+E@ABCDEFGHIJKLMNOPQR
+E
+E@ABCDEFGHIJKLMNOPQR
+E꤁EEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{]}~
+EEEEE
+ځہ܁݁ށ߁EEEEE
+STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE
+EEEEEEEEE
+‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+EEEEEEEEEEEEE
+EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+STUVWXYZ[\]^_`EEEEEE
+{|}~
+EEEEEEEEEEEEEEEEEE
+EEEEEEE
+ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈
+EEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE
+˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ
+EEEEE
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+ꞁEEEEE
+SELECT * FROM `sU`;
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sV`;
+bP
+ !"#$%&'()*+,-./
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_
+abcdefghijklmno
+pqrstuvwxyz{|}~
+
+
+
+
+SELECT * FROM `sW`;
+bP
+@@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{]}~
+EEEEE
+EEEEEE
+EEEEEEEEEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE
+ځہ܁݁ށ߁EEEEE
+EEEEEEEEEE@
+EEEEEEEEEEEEEEEEOPQR
+STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE
+EEEEE
+EEEEEEEEE
+E
+‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+EEEEEEEEEEEEE
+E
+EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`EEEEEE
+EEEEEEEEEpqrstuvwxyz
+{|}~
+EEEEEEEEEEEEEEEEEE
+E
+EEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+E
+ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈
+EEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+E
+˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ
+EEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+ꞁEEEEE
+E꤁EEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+SELECT * FROM `sX`;
+bP
+\\\\\\\\\\\\\\\\\\\\
+drop table `sP`;
+drop table `sQ`;
+drop table `sR`;
+drop table `sS`;
+drop table `sT`;
+drop table `sU`;
+drop table `sV`;
+drop table `sW`;
+drop table `sX`;
diff --git a/mysql-test/suite/jp/r/jp_select_ucs2.result b/mysql-test/suite/jp/r/jp_select_ucs2.result
new file mode 100644
index 00000000..a02cc2ea
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_select_ucs2.result
@@ -0,0 +1,171 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = heap;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = heap;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = heap;
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+SELECT * FROM `ԣ`;
+c1
+
+PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ`;
+c1
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ
+SELECT * FROM `ԣ`;
+c1
+~Ïġ
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT * FROM `ԣ`;
+c1
+
+PQRSTUVWXYZ[\]^_
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ`;
+c1
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+\¡áġšơ
+SELECT * FROM `ԣ`;
+c1
+~Ïġ
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+SELECT * FROM `ԣ`;
+c1
+PQRSTUVWXYZ[\]^_
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ`;
+c1
+\¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+SELECT * FROM `ԣ`;
+c1
+~Ïġ
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_select_ujis.result b/mysql-test/suite/jp/r/jp_select_ujis.result
new file mode 100644
index 00000000..b8dbe2f6
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_select_ujis.result
@@ -0,0 +1,404 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+SELECT * FROM `ԣ`;
+c1
+ !"#$%&'()*+,-./
+
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+abcdefghijklmno
+PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ`;
+c1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ
+
+ܢݢޢߢꡦ
+£ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ
+󡦡
+¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ
+
+¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ
+񡦡
+
+°ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+дежзийклмноп
+
+
+
+
+
+
+
+SELECT * FROM `ԣ`;
+c1
+񡦡
+ȏɏʏˏ̏͏Ρ
+ȏɏʏˏ̏͏ΏϏС
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦
+Ïġ
+
+
+
+
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+ÏďŏƏ
+ÏďŏƏ
+
+돢쏢폢
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ`;
+c1
+ !"#$%&'()*+,-./
+
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+abcdefghijklmno
+PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ`;
+c1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ
+
+
+ʢˢ̢͢΢ϢС
+
+
+
+
+
+
+
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+
+
+¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ
+
+ܢݢޢߢꡦ
+£ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ
+󡦡
+¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ
+
+¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+ܧݧާߧ
+񡦡
+
+°ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰
+
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+дежзийклмноп
+
+
+
+
+
+
+
+SELECT * FROM `ԣ`;
+c1
+񡦡
+ȏɏʏˏ̏͏Ρ
+ȏɏʏˏ̏͏ΏϏС
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦
+Ïġ
+
+
+
+
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+ÏďŏƏ
+ÏďŏƏ
+
+돢쏢폢
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ`;
+c1
+ !"#$%&'()*+,-./
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_
+abcdefghijklmno
+pqrstuvwxyz{|}~
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
+SELECT * FROM `ԣ`;
+c1
+
+¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ
+
+
+
+ʢˢ̢͢΢ϢС
+ܢݢޢߢꡦ
+
+
+£ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+
+
+¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ
+󡦡
+
+¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ
+
+
+¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ
+ܧݧާߧ
+񡦡
+
+
+
+
+
+
+°ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+дежзийклмноп
+
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ`;
+c1
+
+Ïġ
+
+돢쏢폢
+񡦡
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏Ρ
+
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏС
+
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+
+áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_select_utf8.result b/mysql-test/suite/jp/r/jp_select_utf8.result
new file mode 100644
index 00000000..bc7b23cd
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_select_utf8.result
@@ -0,0 +1,404 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+SELECT * FROM `T1`;
+c1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+abcdefghijklmno
+PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚
+SELECT * FROM `T2`;
+c1
+θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・
+SELECT * FROM `T3`;
+c1
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+・áàäâăǎāąåãćĉčçċďéèë
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・・・・・・・・・・・・・æđðħıijĸ
+・・・・・・・・・・・・・・ЂЃЄЅІЇ
+・・・・・・・・・・・・・・・ºª©®™
+・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+SELECT * FROM `T4`;
+c1
+ !"#$%&'()*+,-./
+ 。「」、・ヲァィゥェォャュョッ
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+abcdefghijklmno
+PQRSTUVWXYZ[\]^_
+pqrstuvwxyz{|}~
+ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚
+SELECT * FROM `T5`;
+c1
+θικλμνξοπρστυφχψω・・・
+ΥΦΧΨΩ・・・・・・・・αβγδεζη
+клмнопрстуфхцчшщъыьэ
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+юя・・・・・・・・・・・・・・・・・・
+“”()〔〕[]{}〈〉《》「」『』【】
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・
+ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+・АБВГДЕЁЖЗИЙКЛМНОПРС
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+・ァアィイゥウェエォオカガキギクグケゲコ
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・・・・・・・・абвгдеёжзий
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・0123
+・・・・・abcdefghijklmno
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+$¢£%#&*@§☆★○●◎◇・・・・・
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・
+pqrstuvwxyz・・・・・・・・・
+SELECT * FROM `T6`;
+c1
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+ǖŵýÿŷźžż・・・・・・・・・・・・
+¤№・・・・・・・・・・・・・・・・・・
+łŀʼnŋøœßŧþ・・・・・・・・・・・
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+・áàäâăǎāąåãćĉčçċďéèë
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・・・・・・・・・・・・・æđðħıijĸ
+・・・・・・・・・・・・・・ЂЃЄЅІЇ
+・・・・・・・・・・・・・・・ºª©®™
+・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+SELECT * FROM `T7`;
+c1
+ !"#$%&'()*+,-./
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\]^_
+abcdefghijklmno
+pqrstuvwxyz{|}~
+ 。「」、・ヲァィゥェォャュョッ
+ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚
+SELECT * FROM `T8`;
+c1
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+“”()〔〕[]{}〈〉《》「」『』【】
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+$¢£%#&*@§☆★○●◎◇・・・・・
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・・・・・・・・・・・・・・・0123
+456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・
+・・・・・abcdefghijklmno
+pqrstuvwxyz・・・・・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・
+・ァアィイゥウェエォオカガキギクグケゲコ
+ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+ΥΦΧΨΩ・・・・・・・・αβγδεζη
+θικλμνξοπρστυφχψω・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・АБВГДЕЁЖЗИЙКЛМНОПРС
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+・・・・・・・・・абвгдеёжзий
+клмнопрстуфхцчшщъыьэ
+юя・・・・・・・・・・・・・・・・・・
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+SELECT * FROM `T9`;
+c1
+・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・ºª©®™
+¤№・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・ЂЃЄЅІЇ
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・・・・・・・・・・・・・æđðħıijĸ
+łŀʼnŋøœßŧþ・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+・áàäâăǎāąåãćĉčçċďéèë
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǖŵýÿŷźžż・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+drop table `T1`;
+drop table `T2`;
+drop table `T3`;
+drop table `T4`;
+drop table `T5`;
+drop table `T6`;
+drop table `T7`;
+drop table `T8`;
+drop table `T9`;
diff --git a/mysql-test/suite/jp/r/jp_subquery_sjis.result b/mysql-test/suite/jp/r/jp_subquery_sjis.result
new file mode 100644
index 00000000..d1dd688e
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_subquery_sjis.result
@@ -0,0 +1,155 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sPa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sPb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sSa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sSb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sVa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sVb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sPa` VALUES (''),(''),('');
+INSERT INTO `sPb` VALUES ('');
+INSERT INTO `sQa` VALUES (''),(''),('');
+INSERT INTO `sQb` VALUES ('');
+INSERT INTO `sRa` VALUES ('\'),('\'),('\');
+INSERT INTO `sRb` VALUES ('\');
+INSERT INTO `sSa` VALUES (''),(''),('');
+INSERT INTO `sSb` VALUES ('');
+INSERT INTO `sTa` VALUES (''),(''),('');
+INSERT INTO `sTb` VALUES ('');
+INSERT INTO `sUa` VALUES ('\'),('\'),('\');
+INSERT INTO `sUb` VALUES ('\');
+INSERT INTO `sVa` VALUES (''),(''),('');
+INSERT INTO `sVb` VALUES ('');
+INSERT INTO `sWa` VALUES (''),(''),('');
+INSERT INTO `sWb` VALUES ('');
+INSERT INTO `sXa` VALUES ('\'),('\'),('\');
+INSERT INTO `sXb` VALUES ('\');
+SELECT `bP` FROM `sPa` WHERE `bP` IN (SELECT `bP` FROM `sPb`);
+bP
+
+SELECT `bP` FROM `sPa` WHERE EXISTS (SELECT `bP` FROM `sPb` WHERE `sPa`.`bP` = `sPb`.`bP`);
+bP
+
+SELECT `bP` FROM `sPa` WHERE NOT EXISTS (SELECT `bP` FROM `sPb` WHERE `sPa`.`bP` = `sPb`.`bP`);
+bP
+
+
+SELECT `bP` FROM `sQa` WHERE `bP` IN (SELECT `bP` FROM `sQb`);
+bP
+
+SELECT `bP` FROM `sQa` WHERE EXISTS (SELECT `bP` FROM `sQb` WHERE `sQa`.`bP` = `sQb`.`bP`);
+bP
+
+SELECT `bP` FROM `sQa` WHERE NOT EXISTS (SELECT `bP` FROM `sQb` WHERE `sQa`.`bP` = `sQb`.`bP`);
+bP
+
+
+SELECT `bP` FROM `sRa` WHERE `bP` IN (SELECT `bP` FROM `sRb`);
+bP
+\
+SELECT `bP` FROM `sRa` WHERE EXISTS (SELECT `bP` FROM `sRb` WHERE `sRa`.`bP` = `sRb`.`bP`);
+bP
+\
+SELECT `bP` FROM `sRa` WHERE NOT EXISTS (SELECT `bP` FROM `sRb` WHERE `sRa`.`bP` = `sRb`.`bP`);
+bP
+\
+\
+SELECT `bP` FROM `sSa` WHERE `bP` IN (SELECT `bP` FROM `sSb`);
+bP
+
+SELECT `bP` FROM `sSa` WHERE EXISTS (SELECT `bP` FROM `sSb` WHERE `sSa`.`bP` = `sSb`.`bP`);
+bP
+
+SELECT `bP` FROM `sSa` WHERE NOT EXISTS (SELECT `bP` FROM `sSb` WHERE `sSa`.`bP` = `sSb`.`bP`);
+bP
+
+
+SELECT `bP` FROM `sTa` WHERE `bP` IN (SELECT `bP` FROM `sTb`);
+bP
+
+SELECT `bP` FROM `sTa` WHERE EXISTS (SELECT `bP` FROM `sTb` WHERE `sTa`.`bP` = `sTb`.`bP`);
+bP
+
+SELECT `bP` FROM `sTa` WHERE NOT EXISTS (SELECT `bP` FROM `sTb` WHERE `sTa`.`bP` = `sTb`.`bP`);
+bP
+
+
+SELECT `bP` FROM `sUa` WHERE `bP` IN (SELECT `bP` FROM `sUb`);
+bP
+\
+SELECT `bP` FROM `sUa` WHERE EXISTS (SELECT `bP` FROM `sUb` WHERE `sUa`.`bP` = `sUb`.`bP`);
+bP
+\
+SELECT `bP` FROM `sUa` WHERE NOT EXISTS (SELECT `bP` FROM `sUb` WHERE `sUa`.`bP` = `sUb`.`bP`);
+bP
+\
+\
+SELECT `bP` FROM `sVa` WHERE `bP` IN (SELECT `bP` FROM `sVb`);
+bP
+
+SELECT `bP` FROM `sVa` WHERE EXISTS (SELECT `bP` FROM `sVb` WHERE `sVa`.`bP` = `sVb`.`bP`);
+bP
+
+SELECT `bP` FROM `sVa` WHERE NOT EXISTS (SELECT `bP` FROM `sVb` WHERE `sVa`.`bP` = `sVb`.`bP`);
+bP
+
+
+SELECT `bP` FROM `sWa` WHERE `bP` IN (SELECT `bP` FROM `sWb`);
+bP
+
+SELECT `bP` FROM `sWa` WHERE EXISTS (SELECT `bP` FROM `sWb` WHERE `sWa`.`bP` = `sWb`.`bP`);
+bP
+
+SELECT `bP` FROM `sWa` WHERE NOT EXISTS (SELECT `bP` FROM `sWb` WHERE `sWa`.`bP` = `sWb`.`bP`);
+bP
+
+
+SELECT `bP` FROM `sXa` WHERE `bP` IN (SELECT `bP` FROM `sXb`);
+bP
+\
+SELECT `bP` FROM `sXa` WHERE EXISTS (SELECT `bP` FROM `sXb` WHERE `sXa`.`bP` = `sXb`.`bP`);
+bP
+\
+SELECT `bP` FROM `sXa` WHERE NOT EXISTS (SELECT `bP` FROM `sXb` WHERE `sXa`.`bP` = `sXb`.`bP`);
+bP
+\
+\
+DROP TABLE `sPa`;
+DROP TABLE `sPb`;
+DROP TABLE `sQa`;
+DROP TABLE `sQb`;
+DROP TABLE `sRa`;
+DROP TABLE `sRb`;
+DROP TABLE `sSa`;
+DROP TABLE `sSb`;
+DROP TABLE `sTa`;
+DROP TABLE `sTb`;
+DROP TABLE `sUa`;
+DROP TABLE `sUb`;
+DROP TABLE `sVa`;
+DROP TABLE `sVb`;
+DROP TABLE `sWa`;
+DROP TABLE `sWb`;
+DROP TABLE `sXa`;
+DROP TABLE `sXb`;
diff --git a/mysql-test/suite/jp/r/jp_subquery_ucs2.result b/mysql-test/suite/jp/r/jp_subquery_ucs2.result
new file mode 100644
index 00000000..1cafa1ae
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_subquery_ucs2.result
@@ -0,0 +1,165 @@
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/r/jp_subquery_ujis.result b/mysql-test/suite/jp/r/jp_subquery_ujis.result
new file mode 100644
index 00000000..530f7e1a
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_subquery_ujis.result
@@ -0,0 +1,164 @@
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/r/jp_subquery_utf8.result b/mysql-test/suite/jp/r/jp_subquery_utf8.result
new file mode 100644
index 00000000..d82cfbac
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_subquery_utf8.result
@@ -0,0 +1,155 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T1b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T4b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T7b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T1b` VALUES ('ア');
+INSERT INTO `T2a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T2b` VALUES ('あ');
+INSERT INTO `T3a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T3b` VALUES ('龔');
+INSERT INTO `T4a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T4b` VALUES ('ア');
+INSERT INTO `T5a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T5b` VALUES ('あ');
+INSERT INTO `T6a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T6b` VALUES ('龔');
+INSERT INTO `T7a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T7b` VALUES ('ア');
+INSERT INTO `T8a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T8b` VALUES ('あ');
+INSERT INTO `T9a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T9b` VALUES ('龔');
+SELECT `C1` FROM `T1a` WHERE `C1` IN (SELECT `C1` FROM `T1b`);
+C1
+ア
+SELECT `C1` FROM `T1a` WHERE EXISTS (SELECT `C1` FROM `T1b` WHERE `T1a`.`C1` = `T1b`.`C1`);
+C1
+ア
+SELECT `C1` FROM `T1a` WHERE NOT EXISTS (SELECT `C1` FROM `T1b` WHERE `T1a`.`C1` = `T1b`.`C1`);
+C1
+カ
+サ
+SELECT `C1` FROM `T2a` WHERE `C1` IN (SELECT `C1` FROM `T2b`);
+C1
+あ
+SELECT `C1` FROM `T2a` WHERE EXISTS (SELECT `C1` FROM `T2b` WHERE `T2a`.`C1` = `T2b`.`C1`);
+C1
+あ
+SELECT `C1` FROM `T2a` WHERE NOT EXISTS (SELECT `C1` FROM `T2b` WHERE `T2a`.`C1` = `T2b`.`C1`);
+C1
+か
+さ
+SELECT `C1` FROM `T3a` WHERE `C1` IN (SELECT `C1` FROM `T3b`);
+C1
+龔
+SELECT `C1` FROM `T3a` WHERE EXISTS (SELECT `C1` FROM `T3b` WHERE `T3a`.`C1` = `T3b`.`C1`);
+C1
+龔
+SELECT `C1` FROM `T3a` WHERE NOT EXISTS (SELECT `C1` FROM `T3b` WHERE `T3a`.`C1` = `T3b`.`C1`);
+C1
+龖
+龗
+SELECT `C1` FROM `T4a` WHERE `C1` IN (SELECT `C1` FROM `T4b`);
+C1
+ア
+SELECT `C1` FROM `T4a` WHERE EXISTS (SELECT `C1` FROM `T4b` WHERE `T4a`.`C1` = `T4b`.`C1`);
+C1
+ア
+SELECT `C1` FROM `T4a` WHERE NOT EXISTS (SELECT `C1` FROM `T4b` WHERE `T4a`.`C1` = `T4b`.`C1`);
+C1
+カ
+サ
+SELECT `C1` FROM `T5a` WHERE `C1` IN (SELECT `C1` FROM `T5b`);
+C1
+あ
+SELECT `C1` FROM `T5a` WHERE EXISTS (SELECT `C1` FROM `T5b` WHERE `T5a`.`C1` = `T5b`.`C1`);
+C1
+あ
+SELECT `C1` FROM `T5a` WHERE NOT EXISTS (SELECT `C1` FROM `T5b` WHERE `T5a`.`C1` = `T5b`.`C1`);
+C1
+か
+さ
+SELECT `C1` FROM `T6a` WHERE `C1` IN (SELECT `C1` FROM `T6b`);
+C1
+龔
+SELECT `C1` FROM `T6a` WHERE EXISTS (SELECT `C1` FROM `T6b` WHERE `T6a`.`C1` = `T6b`.`C1`);
+C1
+龔
+SELECT `C1` FROM `T6a` WHERE NOT EXISTS (SELECT `C1` FROM `T6b` WHERE `T6a`.`C1` = `T6b`.`C1`);
+C1
+龖
+龗
+SELECT `C1` FROM `T7a` WHERE `C1` IN (SELECT `C1` FROM `T7b`);
+C1
+ア
+SELECT `C1` FROM `T7a` WHERE EXISTS (SELECT `C1` FROM `T7b` WHERE `T7a`.`C1` = `T7b`.`C1`);
+C1
+ア
+SELECT `C1` FROM `T7a` WHERE NOT EXISTS (SELECT `C1` FROM `T7b` WHERE `T7a`.`C1` = `T7b`.`C1`);
+C1
+カ
+サ
+SELECT `C1` FROM `T8a` WHERE `C1` IN (SELECT `C1` FROM `T8b`);
+C1
+あ
+SELECT `C1` FROM `T8a` WHERE EXISTS (SELECT `C1` FROM `T8b` WHERE `T8a`.`C1` = `T8b`.`C1`);
+C1
+あ
+SELECT `C1` FROM `T8a` WHERE NOT EXISTS (SELECT `C1` FROM `T8b` WHERE `T8a`.`C1` = `T8b`.`C1`);
+C1
+か
+さ
+SELECT `C1` FROM `T9a` WHERE `C1` IN (SELECT `C1` FROM `T9b`);
+C1
+龔
+SELECT `C1` FROM `T9a` WHERE EXISTS (SELECT `C1` FROM `T9b` WHERE `T9a`.`C1` = `T9b`.`C1`);
+C1
+龔
+SELECT `C1` FROM `T9a` WHERE NOT EXISTS (SELECT `C1` FROM `T9b` WHERE `T9a`.`C1` = `T9b`.`C1`);
+C1
+龖
+龗
+DROP TABLE `T1a`;
+DROP TABLE `T1b`;
+DROP TABLE `T2a`;
+DROP TABLE `T2b`;
+DROP TABLE `T3a`;
+DROP TABLE `T3b`;
+DROP TABLE `T4a`;
+DROP TABLE `T4b`;
+DROP TABLE `T5a`;
+DROP TABLE `T5b`;
+DROP TABLE `T6a`;
+DROP TABLE `T6b`;
+DROP TABLE `T7a`;
+DROP TABLE `T7b`;
+DROP TABLE `T8a`;
+DROP TABLE `T8b`;
+DROP TABLE `T9a`;
+DROP TABLE `T9b`;
diff --git a/mysql-test/suite/jp/r/jp_substring_sjis.result b/mysql-test/suite/jp/r/jp_substring_sjis.result
new file mode 100644
index 00000000..a8e98cc6
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_substring_sjis.result
@@ -0,0 +1,2054 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sP`;
+bP SUBSTRING(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sP`;
+bP SUBSTRING(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sP`;
+bP SUBSTRING(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sP`;
+bP SUBSTRING(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sP`;
+bP SUBSTRING(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sP`;
+bP SUBSTRING(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sP`;
+bP SUBSTRING(`bP`,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sP`;
+bP SUBSTRING(`bP` FROM 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sP`;
+bP SUBSTRING(`bP` FROM 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sP`;
+bP SUBSTRING(`bP` FROM 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sP`;
+bP SUBSTRING(`bP` FROM 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sP`;
+bP SUBSTRING(`bP` FROM 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sP`;
+bP SUBSTRING(`bP` FROM 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sP`;
+bP SUBSTRING(`bP`,1,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sP`;
+bP SUBSTRING(`bP`,1,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sP`;
+bP SUBSTRING(`bP`,1,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sP`;
+bP SUBSTRING(`bP`,1,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sP`;
+bP SUBSTRING(`bP`,1,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sP`;
+bP SUBSTRING(`bP`,1,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sP`;
+bP SUBSTRING(`bP`,1,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sP`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sQ`;
+bP SUBSTRING(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sQ`;
+bP SUBSTRING(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sQ`;
+bP SUBSTRING(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sQ`;
+bP SUBSTRING(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sQ`;
+bP SUBSTRING(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sQ`;
+bP SUBSTRING(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sQ`;
+bP SUBSTRING(`bP`,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sQ`;
+bP SUBSTRING(`bP`,1,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sQ`;
+bP SUBSTRING(`bP`,1,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sQ`;
+bP SUBSTRING(`bP`,1,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sQ`;
+bP SUBSTRING(`bP`,1,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sQ`;
+bP SUBSTRING(`bP`,1,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sQ`;
+bP SUBSTRING(`bP`,1,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sQ`;
+bP SUBSTRING(`bP`,1,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sQ`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sR`;
+bP SUBSTRING(`bP`,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sR`;
+bP SUBSTRING(`bP`,1)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sR`;
+bP SUBSTRING(`bP`,2)
+
+\
+\\ \
+\\\ \\
+\\\\ \\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sR`;
+bP SUBSTRING(`bP`,3)
+
+\
+\\
+\\\ \
+\\\\ \\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sR`;
+bP SUBSTRING(`bP`,4)
+
+\
+\\
+\\\
+\\\\ \
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sR`;
+bP SUBSTRING(`bP`,5)
+
+\
+\\
+\\\
+\\\\
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sR`;
+bP SUBSTRING(`bP`,6)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sR`;
+bP SUBSTRING(`bP` FROM 0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sR`;
+bP SUBSTRING(`bP` FROM 2)
+
+\
+\\ \
+\\\ \\
+\\\\ \\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sR`;
+bP SUBSTRING(`bP` FROM 3)
+
+\
+\\
+\\\ \
+\\\\ \\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sR`;
+bP SUBSTRING(`bP` FROM 4)
+
+\
+\\
+\\\
+\\\\ \
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sR`;
+bP SUBSTRING(`bP` FROM 5)
+
+\
+\\
+\\\
+\\\\
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sR`;
+bP SUBSTRING(`bP` FROM 6)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sR`;
+bP SUBSTRING(`bP`,1,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sR`;
+bP SUBSTRING(`bP`,1,1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sR`;
+bP SUBSTRING(`bP`,1,2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sR`;
+bP SUBSTRING(`bP`,1,3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sR`;
+bP SUBSTRING(`bP`,1,4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sR`;
+bP SUBSTRING(`bP`,1,5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sR`;
+bP SUBSTRING(`bP`,1,6)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sR`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sS`;
+bP SUBSTRING(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sS`;
+bP SUBSTRING(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sS`;
+bP SUBSTRING(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sS`;
+bP SUBSTRING(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sS`;
+bP SUBSTRING(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sS`;
+bP SUBSTRING(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sS`;
+bP SUBSTRING(`bP`,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sS`;
+bP SUBSTRING(`bP` FROM 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sS`;
+bP SUBSTRING(`bP` FROM 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sS`;
+bP SUBSTRING(`bP` FROM 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sS`;
+bP SUBSTRING(`bP` FROM 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sS`;
+bP SUBSTRING(`bP` FROM 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sS`;
+bP SUBSTRING(`bP` FROM 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sS`;
+bP SUBSTRING(`bP`,1,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sS`;
+bP SUBSTRING(`bP`,1,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sS`;
+bP SUBSTRING(`bP`,1,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sS`;
+bP SUBSTRING(`bP`,1,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sS`;
+bP SUBSTRING(`bP`,1,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sS`;
+bP SUBSTRING(`bP`,1,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sS`;
+bP SUBSTRING(`bP`,1,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sS`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sT`;
+bP SUBSTRING(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sT`;
+bP SUBSTRING(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sT`;
+bP SUBSTRING(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sT`;
+bP SUBSTRING(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sT`;
+bP SUBSTRING(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sT`;
+bP SUBSTRING(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sT`;
+bP SUBSTRING(`bP`,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sT`;
+bP SUBSTRING(`bP` FROM 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sT`;
+bP SUBSTRING(`bP` FROM 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sT`;
+bP SUBSTRING(`bP` FROM 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sT`;
+bP SUBSTRING(`bP` FROM 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sT`;
+bP SUBSTRING(`bP` FROM 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sT`;
+bP SUBSTRING(`bP` FROM 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sT`;
+bP SUBSTRING(`bP`,1,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sT`;
+bP SUBSTRING(`bP`,1,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sT`;
+bP SUBSTRING(`bP`,1,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sT`;
+bP SUBSTRING(`bP`,1,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sT`;
+bP SUBSTRING(`bP`,1,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sT`;
+bP SUBSTRING(`bP`,1,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sT`;
+bP SUBSTRING(`bP`,1,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sT`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sU`;
+bP SUBSTRING(`bP`,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sU`;
+bP SUBSTRING(`bP`,1)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sU`;
+bP SUBSTRING(`bP`,2)
+
+\
+\\ \
+\\\ \\
+\\\\ \\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sU`;
+bP SUBSTRING(`bP`,3)
+
+\
+\\
+\\\ \
+\\\\ \\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sU`;
+bP SUBSTRING(`bP`,4)
+
+\
+\\
+\\\
+\\\\ \
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sU`;
+bP SUBSTRING(`bP`,5)
+
+\
+\\
+\\\
+\\\\
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sU`;
+bP SUBSTRING(`bP`,6)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sU`;
+bP SUBSTRING(`bP` FROM 0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sU`;
+bP SUBSTRING(`bP` FROM 2)
+
+\
+\\ \
+\\\ \\
+\\\\ \\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sU`;
+bP SUBSTRING(`bP` FROM 3)
+
+\
+\\
+\\\ \
+\\\\ \\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sU`;
+bP SUBSTRING(`bP` FROM 4)
+
+\
+\\
+\\\
+\\\\ \
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sU`;
+bP SUBSTRING(`bP` FROM 5)
+
+\
+\\
+\\\
+\\\\
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sU`;
+bP SUBSTRING(`bP` FROM 6)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sU`;
+bP SUBSTRING(`bP`,1,0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sU`;
+bP SUBSTRING(`bP`,1,1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sU`;
+bP SUBSTRING(`bP`,1,2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sU`;
+bP SUBSTRING(`bP`,1,3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sU`;
+bP SUBSTRING(`bP`,1,4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sU`;
+bP SUBSTRING(`bP`,1,5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sU`;
+bP SUBSTRING(`bP`,1,6)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+\
+\\
+\\\
+\\\\
+\\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+\ \
+\\ \
+\\\ \
+\\\\ \
+\\\\\ \
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+\ \
+\\ \\
+\\\ \\
+\\\\ \\
+\\\\\ \\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\
+\\\\\ \\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sU`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+\ \
+\\ \\
+\\\ \\\
+\\\\ \\\\
+\\\\\ \\\\\
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sV`;
+bP SUBSTRING(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sV`;
+bP SUBSTRING(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sV`;
+bP SUBSTRING(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sV`;
+bP SUBSTRING(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sV`;
+bP SUBSTRING(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sV`;
+bP SUBSTRING(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sV`;
+bP SUBSTRING(`bP`,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sV`;
+bP SUBSTRING(`bP` FROM 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sV`;
+bP SUBSTRING(`bP` FROM 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sV`;
+bP SUBSTRING(`bP` FROM 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sV`;
+bP SUBSTRING(`bP` FROM 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sV`;
+bP SUBSTRING(`bP` FROM 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sV`;
+bP SUBSTRING(`bP` FROM 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sV`;
+bP SUBSTRING(`bP`,1,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sV`;
+bP SUBSTRING(`bP`,1,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sV`;
+bP SUBSTRING(`bP`,1,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sV`;
+bP SUBSTRING(`bP`,1,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sV`;
+bP SUBSTRING(`bP`,1,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sV`;
+bP SUBSTRING(`bP`,1,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sV`;
+bP SUBSTRING(`bP`,1,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sV`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sW`;
+bP SUBSTRING(`bP`,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sW`;
+bP SUBSTRING(`bP`,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sW`;
+bP SUBSTRING(`bP`,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sW`;
+bP SUBSTRING(`bP`,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sW`;
+bP SUBSTRING(`bP`,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sW`;
+bP SUBSTRING(`bP`,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sW`;
+bP SUBSTRING(`bP`,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sW`;
+bP SUBSTRING(`bP` FROM 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sW`;
+bP SUBSTRING(`bP` FROM 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sW`;
+bP SUBSTRING(`bP` FROM 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sW`;
+bP SUBSTRING(`bP` FROM 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sW`;
+bP SUBSTRING(`bP` FROM 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sW`;
+bP SUBSTRING(`bP` FROM 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sW`;
+bP SUBSTRING(`bP`,1,0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sW`;
+bP SUBSTRING(`bP`,1,1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sW`;
+bP SUBSTRING(`bP`,1,2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sW`;
+bP SUBSTRING(`bP`,1,3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sW`;
+bP SUBSTRING(`bP`,1,4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sW`;
+bP SUBSTRING(`bP`,1,5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sW`;
+bP SUBSTRING(`bP`,1,6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sW`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sX`;
+bP SUBSTRING(`bP`,0)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sX`;
+bP SUBSTRING(`bP`,1)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sX`;
+bP SUBSTRING(`bP`,2)
+\\\\\ \\\\
+\\\\ \\\
+\\\ \\
+\\ \
+\
+
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sX`;
+bP SUBSTRING(`bP`,3)
+\\\\\ \\\
+\\\\ \\
+\\\ \
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sX`;
+bP SUBSTRING(`bP`,4)
+\\\\\ \\
+\\\\ \
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sX`;
+bP SUBSTRING(`bP`,5)
+\\\\\ \
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sX`;
+bP SUBSTRING(`bP`,6)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sX`;
+bP SUBSTRING(`bP` FROM 0)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sX`;
+bP SUBSTRING(`bP` FROM 2)
+\\\\\ \\\\
+\\\\ \\\
+\\\ \\
+\\ \
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sX`;
+bP SUBSTRING(`bP` FROM 3)
+\\\\\ \\\
+\\\\ \\
+\\\ \
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sX`;
+bP SUBSTRING(`bP` FROM 4)
+\\\\\ \\
+\\\\ \
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sX`;
+bP SUBSTRING(`bP` FROM 5)
+\\\\\ \
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sX`;
+bP SUBSTRING(`bP` FROM 6)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sX`;
+bP SUBSTRING(`bP`,1,0)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sX`;
+bP SUBSTRING(`bP`,1,1)
+\\\\\ \
+\\\\ \
+\\\ \
+\\ \
+\ \
+
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sX`;
+bP SUBSTRING(`bP`,1,2)
+\\\\\ \\
+\\\\ \\
+\\\ \\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sX`;
+bP SUBSTRING(`bP`,1,3)
+\\\\\ \\\
+\\\\ \\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sX`;
+bP SUBSTRING(`bP`,1,4)
+\\\\\ \\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sX`;
+bP SUBSTRING(`bP`,1,5)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sX`;
+bP SUBSTRING(`bP`,1,6)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 0)
+\\\\\
+\\\\
+\\\
+\\
+\
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 1)
+\\\\\ \
+\\\\ \
+\\\ \
+\\ \
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 2)
+\\\\\ \\
+\\\\ \\
+\\\ \\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 3)
+\\\\\ \\\
+\\\\ \\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 4)
+\\\\\ \\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 5)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sX`;
+bP SUBSTRING(`bP` FROM 1 FOR 6)
+\\\\\ \\\\\
+\\\\ \\\\
+\\\ \\\
+\\ \\
+\ \
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_substring_ucs2.result b/mysql-test/suite/jp/r/jp_substring_ucs2.result
new file mode 100644
index 00000000..5b01928f
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_substring_ucs2.result
@@ -0,0 +1,1047 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+܏ݏޏߏ ܏
+܏ݏޏ ܏
+܏ݏ ܏
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+܏ݏޏߏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+܏ݏޏߏ ܏ݏޏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+܏ݏޏߏ ܏
+܏ݏޏ ܏
+܏ݏ ܏
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+܏ݏޏߏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+܏ݏޏߏ ܏ݏޏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_substring_ujis.result b/mysql-test/suite/jp/r/jp_substring_ujis.result
new file mode 100644
index 00000000..6285271d
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_substring_ujis.result
@@ -0,0 +1,2054 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+܏ݏ ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+܏ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+܏ݏ ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+܏ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+܏ݏ ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+܏ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+܏ݏ ݏ
+܏ݏޏ ݏޏ
+܏ݏޏߏ ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+܏ݏ
+܏ݏޏ ޏ
+܏ݏޏߏ ޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ ߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+܏ݏ
+܏ݏޏ
+܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+܏ ܏
+܏ݏ ܏
+܏ݏޏ ܏
+܏ݏޏߏ ܏
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏޏߏ ܏ݏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+܏ ܏
+܏ݏ ܏ݏ
+܏ݏޏ ܏ݏޏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+
+
+
+
+
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,2)
+܏ݏޏߏ ݏޏߏ
+܏ݏޏ ݏޏ
+܏ݏ ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,3)
+܏ݏޏߏ ޏߏ
+܏ݏޏ ޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,4)
+܏ݏޏߏ ߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,5)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,6)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 2)
+܏ݏޏߏ ݏޏߏ
+܏ݏޏ ݏޏ
+܏ݏ ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 3)
+܏ݏޏߏ ޏߏ
+܏ݏޏ ޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 4)
+܏ݏޏߏ ߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 5)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 6)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,2)
+܏ݏޏߏ ܏
+܏ݏޏ ܏
+܏ݏ ܏
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,3)
+܏ݏޏߏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,4)
+܏ݏޏߏ ܏ݏޏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+ã SUBSTRING(`ã`,1,6)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 0)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 1)
+܏ݏޏߏ
+܏ݏޏ
+܏ݏ
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 2)
+܏ݏޏߏ ܏
+܏ݏޏ ܏
+܏ݏ ܏
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 3)
+܏ݏޏߏ ܏ݏ
+܏ݏޏ ܏ݏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 4)
+܏ݏޏߏ ܏ݏޏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 5)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+ã SUBSTRING(`ã` FROM 1 FOR 6)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏ ܏ݏޏ
+܏ݏ ܏ݏ
+܏ ܏
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_substring_utf8.result b/mysql-test/suite/jp/r/jp_substring_utf8.result
new file mode 100644
index 00000000..80c4ad5c
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_substring_utf8.result
@@ -0,0 +1,2054 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T1`;
+C1 SUBSTRING(`C1`,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T1`;
+C1 SUBSTRING(`C1`,1)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T1`;
+C1 SUBSTRING(`C1`,2)
+
+ア
+アイ イ
+アイウ イウ
+アイウエ イウエ
+アイウエオ イウエオ
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T1`;
+C1 SUBSTRING(`C1`,3)
+
+ア
+アイ
+アイウ ウ
+アイウエ ウエ
+アイウエオ ウエオ
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T1`;
+C1 SUBSTRING(`C1`,4)
+
+ア
+アイ
+アイウ
+アイウエ エ
+アイウエオ エオ
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T1`;
+C1 SUBSTRING(`C1`,5)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ オ
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T1`;
+C1 SUBSTRING(`C1`,6)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 2)
+
+ア
+アイ イ
+アイウ イウ
+アイウエ イウエ
+アイウエオ イウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 3)
+
+ア
+アイ
+アイウ ウ
+アイウエ ウエ
+アイウエオ ウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 4)
+
+ア
+アイ
+アイウ
+アイウエ エ
+アイウエオ エオ
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 5)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ オ
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 6)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T1`;
+C1 SUBSTRING(`C1`,1,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T1`;
+C1 SUBSTRING(`C1`,1,1)
+
+ア ア
+アイ ア
+アイウ ア
+アイウエ ア
+アイウエオ ア
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T1`;
+C1 SUBSTRING(`C1`,1,2)
+
+ア ア
+アイ アイ
+アイウ アイ
+アイウエ アイ
+アイウエオ アイ
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T1`;
+C1 SUBSTRING(`C1`,1,3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウ
+アイウエオ アイウ
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T1`;
+C1 SUBSTRING(`C1`,1,4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエ
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T1`;
+C1 SUBSTRING(`C1`,1,5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T1`;
+C1 SUBSTRING(`C1`,1,6)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+
+ア ア
+アイ ア
+アイウ ア
+アイウエ ア
+アイウエオ ア
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+
+ア ア
+アイ アイ
+アイウ アイ
+アイウエ アイ
+アイウエオ アイ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウ
+アイウエオ アイウ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T1`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T2`;
+C1 SUBSTRING(`C1`,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T2`;
+C1 SUBSTRING(`C1`,1)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T2`;
+C1 SUBSTRING(`C1`,2)
+
+あ
+あい い
+あいう いう
+あいうえ いうえ
+あいうえお いうえお
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T2`;
+C1 SUBSTRING(`C1`,3)
+
+あ
+あい
+あいう う
+あいうえ うえ
+あいうえお うえお
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T2`;
+C1 SUBSTRING(`C1`,4)
+
+あ
+あい
+あいう
+あいうえ え
+あいうえお えお
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T2`;
+C1 SUBSTRING(`C1`,5)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお お
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T2`;
+C1 SUBSTRING(`C1`,6)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 2)
+
+あ
+あい い
+あいう いう
+あいうえ いうえ
+あいうえお いうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 3)
+
+あ
+あい
+あいう う
+あいうえ うえ
+あいうえお うえお
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 4)
+
+あ
+あい
+あいう
+あいうえ え
+あいうえお えお
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 5)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお お
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 6)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T2`;
+C1 SUBSTRING(`C1`,1,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T2`;
+C1 SUBSTRING(`C1`,1,1)
+
+あ あ
+あい あ
+あいう あ
+あいうえ あ
+あいうえお あ
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T2`;
+C1 SUBSTRING(`C1`,1,2)
+
+あ あ
+あい あい
+あいう あい
+あいうえ あい
+あいうえお あい
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T2`;
+C1 SUBSTRING(`C1`,1,3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいう
+あいうえお あいう
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T2`;
+C1 SUBSTRING(`C1`,1,4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえ
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T2`;
+C1 SUBSTRING(`C1`,1,5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T2`;
+C1 SUBSTRING(`C1`,1,6)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+
+あ あ
+あい あ
+あいう あ
+あいうえ あ
+あいうえお あ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+
+あ あ
+あい あい
+あいう あい
+あいうえ あい
+あいうえお あい
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいう
+あいうえお あいう
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T2`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T3`;
+C1 SUBSTRING(`C1`,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T3`;
+C1 SUBSTRING(`C1`,1)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T3`;
+C1 SUBSTRING(`C1`,2)
+
+龔
+龔龖 龖
+龔龖龗 龖龗
+龔龖龗龞 龖龗龞
+龔龖龗龞龡 龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T3`;
+C1 SUBSTRING(`C1`,3)
+
+龔
+龔龖
+龔龖龗 龗
+龔龖龗龞 龗龞
+龔龖龗龞龡 龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T3`;
+C1 SUBSTRING(`C1`,4)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞 龞
+龔龖龗龞龡 龞龡
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T3`;
+C1 SUBSTRING(`C1`,5)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡 龡
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T3`;
+C1 SUBSTRING(`C1`,6)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 2)
+
+龔
+龔龖 龖
+龔龖龗 龖龗
+龔龖龗龞 龖龗龞
+龔龖龗龞龡 龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 3)
+
+龔
+龔龖
+龔龖龗 龗
+龔龖龗龞 龗龞
+龔龖龗龞龡 龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 4)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞 龞
+龔龖龗龞龡 龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 5)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡 龡
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 6)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T3`;
+C1 SUBSTRING(`C1`,1,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T3`;
+C1 SUBSTRING(`C1`,1,1)
+
+龔 龔
+龔龖 龔
+龔龖龗 龔
+龔龖龗龞 龔
+龔龖龗龞龡 龔
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T3`;
+C1 SUBSTRING(`C1`,1,2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖
+龔龖龗龞 龔龖
+龔龖龗龞龡 龔龖
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T3`;
+C1 SUBSTRING(`C1`,1,3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗龞龡 龔龖龗
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T3`;
+C1 SUBSTRING(`C1`,1,4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T3`;
+C1 SUBSTRING(`C1`,1,5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T3`;
+C1 SUBSTRING(`C1`,1,6)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+
+龔 龔
+龔龖 龔
+龔龖龗 龔
+龔龖龗龞 龔
+龔龖龗龞龡 龔
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖
+龔龖龗龞 龔龖
+龔龖龗龞龡 龔龖
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗龞龡 龔龖龗
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T3`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T4`;
+C1 SUBSTRING(`C1`,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T4`;
+C1 SUBSTRING(`C1`,1)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T4`;
+C1 SUBSTRING(`C1`,2)
+
+ア
+アイ イ
+アイウ イウ
+アイウエ イウエ
+アイウエオ イウエオ
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T4`;
+C1 SUBSTRING(`C1`,3)
+
+ア
+アイ
+アイウ ウ
+アイウエ ウエ
+アイウエオ ウエオ
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T4`;
+C1 SUBSTRING(`C1`,4)
+
+ア
+アイ
+アイウ
+アイウエ エ
+アイウエオ エオ
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T4`;
+C1 SUBSTRING(`C1`,5)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ オ
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T4`;
+C1 SUBSTRING(`C1`,6)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 2)
+
+ア
+アイ イ
+アイウ イウ
+アイウエ イウエ
+アイウエオ イウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 3)
+
+ア
+アイ
+アイウ ウ
+アイウエ ウエ
+アイウエオ ウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 4)
+
+ア
+アイ
+アイウ
+アイウエ エ
+アイウエオ エオ
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 5)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ オ
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 6)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T4`;
+C1 SUBSTRING(`C1`,1,0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T4`;
+C1 SUBSTRING(`C1`,1,1)
+
+ア ア
+アイ ア
+アイウ ア
+アイウエ ア
+アイウエオ ア
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T4`;
+C1 SUBSTRING(`C1`,1,2)
+
+ア ア
+アイ アイ
+アイウ アイ
+アイウエ アイ
+アイウエオ アイ
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T4`;
+C1 SUBSTRING(`C1`,1,3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウ
+アイウエオ アイウ
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T4`;
+C1 SUBSTRING(`C1`,1,4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエ
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T4`;
+C1 SUBSTRING(`C1`,1,5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T4`;
+C1 SUBSTRING(`C1`,1,6)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+
+ア
+アイ
+アイウ
+アイウエ
+アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+
+ア ア
+アイ ア
+アイウ ア
+アイウエ ア
+アイウエオ ア
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+
+ア ア
+アイ アイ
+アイウ アイ
+アイウエ アイ
+アイウエオ アイ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウ
+アイウエオ アイウ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T4`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+
+ア ア
+アイ アイ
+アイウ アイウ
+アイウエ アイウエ
+アイウエオ アイウエオ
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T5`;
+C1 SUBSTRING(`C1`,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T5`;
+C1 SUBSTRING(`C1`,1)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T5`;
+C1 SUBSTRING(`C1`,2)
+
+あ
+あい い
+あいう いう
+あいうえ いうえ
+あいうえお いうえお
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T5`;
+C1 SUBSTRING(`C1`,3)
+
+あ
+あい
+あいう う
+あいうえ うえ
+あいうえお うえお
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T5`;
+C1 SUBSTRING(`C1`,4)
+
+あ
+あい
+あいう
+あいうえ え
+あいうえお えお
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T5`;
+C1 SUBSTRING(`C1`,5)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお お
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T5`;
+C1 SUBSTRING(`C1`,6)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 2)
+
+あ
+あい い
+あいう いう
+あいうえ いうえ
+あいうえお いうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 3)
+
+あ
+あい
+あいう う
+あいうえ うえ
+あいうえお うえお
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 4)
+
+あ
+あい
+あいう
+あいうえ え
+あいうえお えお
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 5)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお お
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 6)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T5`;
+C1 SUBSTRING(`C1`,1,0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T5`;
+C1 SUBSTRING(`C1`,1,1)
+
+あ あ
+あい あ
+あいう あ
+あいうえ あ
+あいうえお あ
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T5`;
+C1 SUBSTRING(`C1`,1,2)
+
+あ あ
+あい あい
+あいう あい
+あいうえ あい
+あいうえお あい
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T5`;
+C1 SUBSTRING(`C1`,1,3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいう
+あいうえお あいう
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T5`;
+C1 SUBSTRING(`C1`,1,4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえ
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T5`;
+C1 SUBSTRING(`C1`,1,5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T5`;
+C1 SUBSTRING(`C1`,1,6)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+
+あ
+あい
+あいう
+あいうえ
+あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+
+あ あ
+あい あ
+あいう あ
+あいうえ あ
+あいうえお あ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+
+あ あ
+あい あい
+あいう あい
+あいうえ あい
+あいうえお あい
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいう
+あいうえお あいう
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえ
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T5`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+
+あ あ
+あい あい
+あいう あいう
+あいうえ あいうえ
+あいうえお あいうえお
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T6`;
+C1 SUBSTRING(`C1`,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T6`;
+C1 SUBSTRING(`C1`,1)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T6`;
+C1 SUBSTRING(`C1`,2)
+
+龔
+龔龖 龖
+龔龖龗 龖龗
+龔龖龗龞 龖龗龞
+龔龖龗龞龡 龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T6`;
+C1 SUBSTRING(`C1`,3)
+
+龔
+龔龖
+龔龖龗 龗
+龔龖龗龞 龗龞
+龔龖龗龞龡 龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T6`;
+C1 SUBSTRING(`C1`,4)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞 龞
+龔龖龗龞龡 龞龡
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T6`;
+C1 SUBSTRING(`C1`,5)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡 龡
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T6`;
+C1 SUBSTRING(`C1`,6)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 2)
+
+龔
+龔龖 龖
+龔龖龗 龖龗
+龔龖龗龞 龖龗龞
+龔龖龗龞龡 龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 3)
+
+龔
+龔龖
+龔龖龗 龗
+龔龖龗龞 龗龞
+龔龖龗龞龡 龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 4)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞 龞
+龔龖龗龞龡 龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 5)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡 龡
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 6)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T6`;
+C1 SUBSTRING(`C1`,1,0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T6`;
+C1 SUBSTRING(`C1`,1,1)
+
+龔 龔
+龔龖 龔
+龔龖龗 龔
+龔龖龗龞 龔
+龔龖龗龞龡 龔
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T6`;
+C1 SUBSTRING(`C1`,1,2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖
+龔龖龗龞 龔龖
+龔龖龗龞龡 龔龖
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T6`;
+C1 SUBSTRING(`C1`,1,3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗龞龡 龔龖龗
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T6`;
+C1 SUBSTRING(`C1`,1,4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T6`;
+C1 SUBSTRING(`C1`,1,5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T6`;
+C1 SUBSTRING(`C1`,1,6)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+
+龔
+龔龖
+龔龖龗
+龔龖龗龞
+龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+
+龔 龔
+龔龖 龔
+龔龖龗 龔
+龔龖龗龞 龔
+龔龖龗龞龡 龔
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖
+龔龖龗龞 龔龖
+龔龖龗龞龡 龔龖
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗龞龡 龔龖龗
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T6`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+
+龔 龔
+龔龖 龔龖
+龔龖龗 龔龖龗
+龔龖龗龞 龔龖龗龞
+龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T7`;
+C1 SUBSTRING(`C1`,0)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T7`;
+C1 SUBSTRING(`C1`,1)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T7`;
+C1 SUBSTRING(`C1`,2)
+アイウエオ イウエオ
+アイウエ イウエ
+アイウ イウ
+アイ イ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T7`;
+C1 SUBSTRING(`C1`,3)
+アイウエオ ウエオ
+アイウエ ウエ
+アイウ ウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T7`;
+C1 SUBSTRING(`C1`,4)
+アイウエオ エオ
+アイウエ エ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T7`;
+C1 SUBSTRING(`C1`,5)
+アイウエオ オ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T7`;
+C1 SUBSTRING(`C1`,6)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 0)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 2)
+アイウエオ イウエオ
+アイウエ イウエ
+アイウ イウ
+アイ イ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 3)
+アイウエオ ウエオ
+アイウエ ウエ
+アイウ ウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 4)
+アイウエオ エオ
+アイウエ エ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 5)
+アイウエオ オ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 6)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T7`;
+C1 SUBSTRING(`C1`,1,0)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T7`;
+C1 SUBSTRING(`C1`,1,1)
+アイウエオ ア
+アイウエ ア
+アイウ ア
+アイ ア
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T7`;
+C1 SUBSTRING(`C1`,1,2)
+アイウエオ アイ
+アイウエ アイ
+アイウ アイ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T7`;
+C1 SUBSTRING(`C1`,1,3)
+アイウエオ アイウ
+アイウエ アイウ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T7`;
+C1 SUBSTRING(`C1`,1,4)
+アイウエオ アイウエ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T7`;
+C1 SUBSTRING(`C1`,1,5)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T7`;
+C1 SUBSTRING(`C1`,1,6)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+アイウエオ
+アイウエ
+アイウ
+アイ
+ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+アイウエオ ア
+アイウエ ア
+アイウ ア
+アイ ア
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+アイウエオ アイ
+アイウエ アイ
+アイウ アイ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+アイウエオ アイウ
+アイウエ アイウ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+アイウエオ アイウエ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T7`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+アイウエオ アイウエオ
+アイウエ アイウエ
+アイウ アイウ
+アイ アイ
+ア ア
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T8`;
+C1 SUBSTRING(`C1`,0)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T8`;
+C1 SUBSTRING(`C1`,1)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T8`;
+C1 SUBSTRING(`C1`,2)
+あいうえお いうえお
+あいうえ いうえ
+あいう いう
+あい い
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T8`;
+C1 SUBSTRING(`C1`,3)
+あいうえお うえお
+あいうえ うえ
+あいう う
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T8`;
+C1 SUBSTRING(`C1`,4)
+あいうえお えお
+あいうえ え
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T8`;
+C1 SUBSTRING(`C1`,5)
+あいうえお お
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T8`;
+C1 SUBSTRING(`C1`,6)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 0)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 2)
+あいうえお いうえお
+あいうえ いうえ
+あいう いう
+あい い
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 3)
+あいうえお うえお
+あいうえ うえ
+あいう う
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 4)
+あいうえお えお
+あいうえ え
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 5)
+あいうえお お
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 6)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T8`;
+C1 SUBSTRING(`C1`,1,0)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T8`;
+C1 SUBSTRING(`C1`,1,1)
+あいうえお あ
+あいうえ あ
+あいう あ
+あい あ
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T8`;
+C1 SUBSTRING(`C1`,1,2)
+あいうえお あい
+あいうえ あい
+あいう あい
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T8`;
+C1 SUBSTRING(`C1`,1,3)
+あいうえお あいう
+あいうえ あいう
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T8`;
+C1 SUBSTRING(`C1`,1,4)
+あいうえお あいうえ
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T8`;
+C1 SUBSTRING(`C1`,1,5)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T8`;
+C1 SUBSTRING(`C1`,1,6)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+あいうえお
+あいうえ
+あいう
+あい
+あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+あいうえお あ
+あいうえ あ
+あいう あ
+あい あ
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+あいうえお あい
+あいうえ あい
+あいう あい
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+あいうえお あいう
+あいうえ あいう
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+あいうえお あいうえ
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T8`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+あいうえお あいうえお
+あいうえ あいうえ
+あいう あいう
+あい あい
+あ あ
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T9`;
+C1 SUBSTRING(`C1`,0)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T9`;
+C1 SUBSTRING(`C1`,1)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T9`;
+C1 SUBSTRING(`C1`,2)
+龔龖龗龞龡 龖龗龞龡
+龔龖龗龞 龖龗龞
+龔龖龗 龖龗
+龔龖 龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T9`;
+C1 SUBSTRING(`C1`,3)
+龔龖龗龞龡 龗龞龡
+龔龖龗龞 龗龞
+龔龖龗 龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T9`;
+C1 SUBSTRING(`C1`,4)
+龔龖龗龞龡 龞龡
+龔龖龗龞 龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T9`;
+C1 SUBSTRING(`C1`,5)
+龔龖龗龞龡 龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T9`;
+C1 SUBSTRING(`C1`,6)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 0)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 2)
+龔龖龗龞龡 龖龗龞龡
+龔龖龗龞 龖龗龞
+龔龖龗 龖龗
+龔龖 龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 3)
+龔龖龗龞龡 龗龞龡
+龔龖龗龞 龗龞
+龔龖龗 龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 4)
+龔龖龗龞龡 龞龡
+龔龖龗龞 龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 5)
+龔龖龗龞龡 龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 6)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T9`;
+C1 SUBSTRING(`C1`,1,0)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T9`;
+C1 SUBSTRING(`C1`,1,1)
+龔龖龗龞龡 龔
+龔龖龗龞 龔
+龔龖龗 龔
+龔龖 龔
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T9`;
+C1 SUBSTRING(`C1`,1,2)
+龔龖龗龞龡 龔龖
+龔龖龗龞 龔龖
+龔龖龗 龔龖
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T9`;
+C1 SUBSTRING(`C1`,1,3)
+龔龖龗龞龡 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T9`;
+C1 SUBSTRING(`C1`,1,4)
+龔龖龗龞龡 龔龖龗龞
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T9`;
+C1 SUBSTRING(`C1`,1,5)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T9`;
+C1 SUBSTRING(`C1`,1,6)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 0)
+龔龖龗龞龡
+龔龖龗龞
+龔龖龗
+龔龖
+龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 1)
+龔龖龗龞龡 龔
+龔龖龗龞 龔
+龔龖龗 龔
+龔龖 龔
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 2)
+龔龖龗龞龡 龔龖
+龔龖龗龞 龔龖
+龔龖龗 龔龖
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 3)
+龔龖龗龞龡 龔龖龗
+龔龖龗龞 龔龖龗
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 4)
+龔龖龗龞龡 龔龖龗龞
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 5)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T9`;
+C1 SUBSTRING(`C1` FROM 1 FOR 6)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞 龔龖龗龞
+龔龖龗 龔龖龗
+龔龖 龔龖
+龔 龔
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_trim_sjis.result b/mysql-test/suite/jp/r/jp_trim_sjis.result
new file mode 100644
index 00000000..604b2afc
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_trim_sjis.result
@@ -0,0 +1,510 @@
+SET NAMES sjis;
+SET character_set_database = sjis;
+DROP TABLE IF EXISTS `sP`;
+DROP TABLE IF EXISTS `sQ`;
+DROP TABLE IF EXISTS `sR`;
+CREATE TABLE `sP` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+CREATE TABLE `sQ` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+CREATE TABLE `sR` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\\\\');
+INSERT INTO `sR` VALUES (' \\\\\ ');
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sP`;
+bP TRIM(TRAILING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sP`;
+bP TRIM(LEADING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sP`;
+bP TRIM(BOTH '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(`bP`) FROM `sP`;
+bP TRIM(`bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sQ`;
+bP TRIM(TRAILING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sQ`;
+bP TRIM(LEADING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sQ`;
+bP TRIM(BOTH '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(`bP`) FROM `sQ`;
+bP TRIM(`bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(TRAILING '\' FROM `bP`) FROM `sR`;
+bP TRIM(TRAILING '\' FROM `bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\\\\\\ \\\\\\\\
+SELECT `bP`,TRIM(LEADING '\' FROM `bP`) FROM `sR`;
+bP TRIM(LEADING '\' FROM `bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\\\\\\ \\\\\\\\
+SELECT `bP`,TRIM(BOTH '\' FROM `bP`) FROM `sR`;
+bP TRIM(BOTH '\' FROM `bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\\\\\\ \\\\\
+SELECT `bP`,TRIM(`bP`) FROM `sR`;
+bP TRIM(`bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\\\\\\ \\\\\\\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+DROP TABLE IF EXISTS `sP`;
+DROP TABLE IF EXISTS `sQ`;
+DROP TABLE IF EXISTS `sR`;
+CREATE TABLE `sP` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+CREATE TABLE `sQ` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+CREATE TABLE `sR` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\\\\');
+INSERT INTO `sR` VALUES (' \\\\\ ');
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sP`;
+bP TRIM(TRAILING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sP`;
+bP TRIM(LEADING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sP`;
+bP TRIM(BOTH '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(`bP`) FROM `sP`;
+bP TRIM(`bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sQ`;
+bP TRIM(TRAILING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sQ`;
+bP TRIM(LEADING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sQ`;
+bP TRIM(BOTH '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(`bP`) FROM `sQ`;
+bP TRIM(`bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(TRAILING '\' FROM `bP`) FROM `sR`;
+bP TRIM(TRAILING '\' FROM `bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\\\\\\ \\\\\\\\
+SELECT `bP`,TRIM(LEADING '\' FROM `bP`) FROM `sR`;
+bP TRIM(LEADING '\' FROM `bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\\\\\\ \\\\\\\\
+SELECT `bP`,TRIM(BOTH '\' FROM `bP`) FROM `sR`;
+bP TRIM(BOTH '\' FROM `bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\\\\\\ \\\\\
+SELECT `bP`,TRIM(`bP`) FROM `sR`;
+bP TRIM(`bP`)
+ \\\\\ \\\\\
+\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\\\\\\ \\\\\\\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+DROP TABLE IF EXISTS `sP`;
+DROP TABLE IF EXISTS `sQ`;
+DROP TABLE IF EXISTS `sR`;
+CREATE TABLE `sP` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+CREATE TABLE `sQ` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+CREATE TABLE `sR` (`bP` CHAR(12), INDEX(`bP`)) DEFAULT CHARSET = sjis ENGINE = <engine_to_be_tested>;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\\\\\\\');
+INSERT INTO `sR` VALUES (' \\\\\ ');
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sP`;
+bP TRIM(TRAILING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sP`;
+bP TRIM(LEADING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sP`;
+bP TRIM(BOTH '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(`bP`) FROM `sP`;
+bP TRIM(`bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(TRAILING '' FROM `bP`) FROM `sQ`;
+bP TRIM(TRAILING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(LEADING '' FROM `bP`) FROM `sQ`;
+bP TRIM(LEADING '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(BOTH '' FROM `bP`) FROM `sQ`;
+bP TRIM(BOTH '' FROM `bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(`bP`) FROM `sQ`;
+bP TRIM(`bP`)
+
+
+
+
+
+
+
+
+
+SELECT `bP`,TRIM(TRAILING '\' FROM `bP`) FROM `sR`;
+bP TRIM(TRAILING '\' FROM `bP`)
+\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\\\\\\ \\\\\\\\
+ \\\\\ \\\\\
+SELECT `bP`,TRIM(LEADING '\' FROM `bP`) FROM `sR`;
+bP TRIM(LEADING '\' FROM `bP`)
+\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\\\\\\ \\\\\\\\
+ \\\\\ \\\\\
+SELECT `bP`,TRIM(BOTH '\' FROM `bP`) FROM `sR`;
+bP TRIM(BOTH '\' FROM `bP`)
+\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\ \\\\\
+\\\\\\\ \\\\\
+\\\\\\\\ \\\\\
+\\\\\\\\\\\ \\\\\
+ \\\\\ \\\\\
+SELECT `bP`,TRIM(`bP`) FROM `sR`;
+bP TRIM(`bP`)
+\\\\\ \\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\ \\\\\\
+\\\\\\\ \\\\\\\
+\\\\\\\\ \\\\\\\\
+\\\\\\\\\\\ \\\\\\\\\\\
+ \\\\\ \\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
diff --git a/mysql-test/suite/jp/r/jp_trim_ucs2.result b/mysql-test/suite/jp/r/jp_trim_ucs2.result
new file mode 100644
index 00000000..31ae0ab9
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_trim_ucs2.result
@@ -0,0 +1,507 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING ''FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING ''FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_trim_ujis.result b/mysql-test/suite/jp/r/jp_trim_ujis.result
new file mode 100644
index 00000000..c90d1a50
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_trim_ujis.result
@@ -0,0 +1,506 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING ''FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING ''FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+ ܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+
+
+
+
+
+
+
+
+
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(TRAILING '' FROM `ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+ã TRIM(LEADING '' FROM `ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+ã TRIM(BOTH '' FROM `ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+ã TRIM(`ã`)
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+܏ݏޏߏ ܏ݏޏߏ
+ ܏ݏޏߏ ܏ݏޏߏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_trim_utf8.result b/mysql-test/suite/jp/r/jp_trim_utf8.result
new file mode 100644
index 00000000..4f4849c9
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_trim_utf8.result
@@ -0,0 +1,506 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T1` VALUES ('アイウエオカ');
+INSERT INTO `T1` VALUES ('アイウエオカカ');
+INSERT INTO `T1` VALUES ('アイウエオカカカ');
+INSERT INTO `T1` VALUES ('カアイウエオ');
+INSERT INTO `T1` VALUES ('カカアイウエオ');
+INSERT INTO `T1` VALUES ('カカカアイウエオ');
+INSERT INTO `T1` VALUES ('カカカアイウエオカカカ');
+INSERT INTO `T1` VALUES (' アイウエオ ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T2` VALUES ('あいうえおか');
+INSERT INTO `T2` VALUES ('あいうえおかか');
+INSERT INTO `T2` VALUES ('あいうえおかかか');
+INSERT INTO `T2` VALUES ('かあいうえお');
+INSERT INTO `T2` VALUES ('かかあいうえお');
+INSERT INTO `T2` VALUES ('かかかあいうえお');
+INSERT INTO `T2` VALUES ('かかかあいうえおかかか');
+INSERT INTO `T2` VALUES (' あいうえお ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡丂');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂丂');
+INSERT INTO `T3` VALUES ('丂龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('丂丂龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡 ');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T4` VALUES ('アイウエオカ');
+INSERT INTO `T4` VALUES ('アイウエオカカ');
+INSERT INTO `T4` VALUES ('アイウエオカカカ');
+INSERT INTO `T4` VALUES ('カアイウエオ');
+INSERT INTO `T4` VALUES ('カカアイウエオ');
+INSERT INTO `T4` VALUES ('カカカアイウエオ');
+INSERT INTO `T4` VALUES ('カカカアイウエオカカカ');
+INSERT INTO `T4` VALUES (' アイウエオ ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T5` VALUES ('あいうえおか');
+INSERT INTO `T5` VALUES ('あいうえおかか');
+INSERT INTO `T5` VALUES ('あいうえおかかか');
+INSERT INTO `T5` VALUES ('かあいうえお');
+INSERT INTO `T5` VALUES ('かかあいうえお');
+INSERT INTO `T5` VALUES ('かかかあいうえお');
+INSERT INTO `T5` VALUES ('かかかあいうえおかかか');
+INSERT INTO `T5` VALUES (' あいうえお ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡丂');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂丂');
+INSERT INTO `T6` VALUES ('丂龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('丂丂龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡 ');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T7` VALUES ('アイウエオカ');
+INSERT INTO `T7` VALUES ('アイウエオカカ');
+INSERT INTO `T7` VALUES ('アイウエオカカカ');
+INSERT INTO `T7` VALUES ('カアイウエオ');
+INSERT INTO `T7` VALUES ('カカアイウエオ');
+INSERT INTO `T7` VALUES ('カカカアイウエオ');
+INSERT INTO `T7` VALUES ('カカカアイウエオカカカ');
+INSERT INTO `T7` VALUES (' アイウエオ ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T8` VALUES ('あいうえおか');
+INSERT INTO `T8` VALUES ('あいうえおかか');
+INSERT INTO `T8` VALUES ('あいうえおかかか');
+INSERT INTO `T8` VALUES ('かあいうえお');
+INSERT INTO `T8` VALUES ('かかあいうえお');
+INSERT INTO `T8` VALUES ('かかかあいうえお');
+INSERT INTO `T8` VALUES ('かかかあいうえおかかか');
+INSERT INTO `T8` VALUES (' あいうえお ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡丂');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂丂');
+INSERT INTO `T9` VALUES ('丂龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('丂丂龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡 ');
+SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T1`;
+C1 TRIM(TRAILING 'カ' FROM `C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオ
+アイウエオカカ アイウエオ
+アイウエオカカカ アイウエオ
+カアイウエオ カアイウエオ
+カカアイウエオ カカアイウエオ
+カカカアイウエオ カカカアイウエオ
+カカカアイウエオカカカ カカカアイウエオ
+SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T1`;
+C1 TRIM(LEADING 'カ' FROM `C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオカ
+アイウエオカカ アイウエオカカ
+アイウエオカカカ アイウエオカカカ
+カアイウエオ アイウエオ
+カカアイウエオ アイウエオ
+カカカアイウエオ アイウエオ
+カカカアイウエオカカカ アイウエオカカカ
+SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T1`;
+C1 TRIM(BOTH 'カ' FROM `C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオ
+アイウエオカカ アイウエオ
+アイウエオカカカ アイウエオ
+カアイウエオ アイウエオ
+カカアイウエオ アイウエオ
+カカカアイウエオ アイウエオ
+カカカアイウエオカカカ アイウエオ
+SELECT `C1`,TRIM(`C1`) FROM `T1`;
+C1 TRIM(`C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオカ
+アイウエオカカ アイウエオカカ
+アイウエオカカカ アイウエオカカカ
+カアイウエオ カアイウエオ
+カカアイウエオ カカアイウエオ
+カカカアイウエオ カカカアイウエオ
+カカカアイウエオカカカ カカカアイウエオカカカ
+SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T2`;
+C1 TRIM(TRAILING 'か' FROM `C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえお
+あいうえおかか あいうえお
+あいうえおかかか あいうえお
+かあいうえお かあいうえお
+かかあいうえお かかあいうえお
+かかかあいうえお かかかあいうえお
+かかかあいうえおかかか かかかあいうえお
+SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T2`;
+C1 TRIM(LEADING 'か' FROM `C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえおか
+あいうえおかか あいうえおかか
+あいうえおかかか あいうえおかかか
+かあいうえお あいうえお
+かかあいうえお あいうえお
+かかかあいうえお あいうえお
+かかかあいうえおかかか あいうえおかかか
+SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T2`;
+C1 TRIM(BOTH 'か' FROM `C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえお
+あいうえおかか あいうえお
+あいうえおかかか あいうえお
+かあいうえお あいうえお
+かかあいうえお あいうえお
+かかかあいうえお あいうえお
+かかかあいうえおかかか あいうえお
+SELECT `C1`,TRIM(`C1`) FROM `T2`;
+C1 TRIM(`C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえおか
+あいうえおかか あいうえおかか
+あいうえおかかか あいうえおかかか
+かあいうえお かあいうえお
+かかあいうえお かかあいうえお
+かかかあいうえお かかかあいうえお
+かかかあいうえおかかか かかかあいうえおかかか
+SELECT `C1`,TRIM(TRAILING '丂'FROM `C1`) FROM `T3`;
+C1 TRIM(TRAILING '丂'FROM `C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 丂丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 丂丂丂龔龖龗龞龡
+丂丂龔龖龗龞龡 丂丂龔龖龗龞龡
+丂龔龖龗龞龡 丂龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡
+龔龖龗龞龡丂丂 龔龖龗龞龡
+龔龖龗龞龡丂丂丂 龔龖龗龞龡
+SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T3`;
+C1 TRIM(LEADING '丂' FROM `C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+丂丂龔龖龗龞龡 龔龖龗龞龡
+丂龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡丂
+龔龖龗龞龡丂丂 龔龖龗龞龡丂丂
+龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T3`;
+C1 TRIM(BOTH '丂' FROM `C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 龔龖龗龞龡
+丂丂龔龖龗龞龡 龔龖龗龞龡
+丂龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡
+龔龖龗龞龡丂丂 龔龖龗龞龡
+龔龖龗龞龡丂丂丂 龔龖龗龞龡
+SELECT `C1`,TRIM(`C1`) FROM `T3`;
+C1 TRIM(`C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 丂丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 丂丂丂龔龖龗龞龡丂丂丂
+丂丂龔龖龗龞龡 丂丂龔龖龗龞龡
+丂龔龖龗龞龡 丂龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡丂
+龔龖龗龞龡丂丂 龔龖龗龞龡丂丂
+龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T4`;
+C1 TRIM(TRAILING 'カ' FROM `C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオ
+アイウエオカカ アイウエオ
+アイウエオカカカ アイウエオ
+カアイウエオ カアイウエオ
+カカアイウエオ カカアイウエオ
+カカカアイウエオ カカカアイウエオ
+カカカアイウエオカカカ カカカアイウエオ
+SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T4`;
+C1 TRIM(LEADING 'カ' FROM `C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオカ
+アイウエオカカ アイウエオカカ
+アイウエオカカカ アイウエオカカカ
+カアイウエオ アイウエオ
+カカアイウエオ アイウエオ
+カカカアイウエオ アイウエオ
+カカカアイウエオカカカ アイウエオカカカ
+SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T4`;
+C1 TRIM(BOTH 'カ' FROM `C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオ
+アイウエオカカ アイウエオ
+アイウエオカカカ アイウエオ
+カアイウエオ アイウエオ
+カカアイウエオ アイウエオ
+カカカアイウエオ アイウエオ
+カカカアイウエオカカカ アイウエオ
+SELECT `C1`,TRIM(`C1`) FROM `T4`;
+C1 TRIM(`C1`)
+ アイウエオ アイウエオ
+アイウエオ アイウエオ
+アイウエオカ アイウエオカ
+アイウエオカカ アイウエオカカ
+アイウエオカカカ アイウエオカカカ
+カアイウエオ カアイウエオ
+カカアイウエオ カカアイウエオ
+カカカアイウエオ カカカアイウエオ
+カカカアイウエオカカカ カカカアイウエオカカカ
+SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T5`;
+C1 TRIM(TRAILING 'か' FROM `C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえお
+あいうえおかか あいうえお
+あいうえおかかか あいうえお
+かあいうえお かあいうえお
+かかあいうえお かかあいうえお
+かかかあいうえお かかかあいうえお
+かかかあいうえおかかか かかかあいうえお
+SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T5`;
+C1 TRIM(LEADING 'か' FROM `C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえおか
+あいうえおかか あいうえおかか
+あいうえおかかか あいうえおかかか
+かあいうえお あいうえお
+かかあいうえお あいうえお
+かかかあいうえお あいうえお
+かかかあいうえおかかか あいうえおかかか
+SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T5`;
+C1 TRIM(BOTH 'か' FROM `C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえお
+あいうえおかか あいうえお
+あいうえおかかか あいうえお
+かあいうえお あいうえお
+かかあいうえお あいうえお
+かかかあいうえお あいうえお
+かかかあいうえおかかか あいうえお
+SELECT `C1`,TRIM(`C1`) FROM `T5`;
+C1 TRIM(`C1`)
+ あいうえお あいうえお
+あいうえお あいうえお
+あいうえおか あいうえおか
+あいうえおかか あいうえおかか
+あいうえおかかか あいうえおかかか
+かあいうえお かあいうえお
+かかあいうえお かかあいうえお
+かかかあいうえお かかかあいうえお
+かかかあいうえおかかか かかかあいうえおかかか
+SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T6`;
+C1 TRIM(TRAILING '丂' FROM `C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 丂丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 丂丂丂龔龖龗龞龡
+丂丂龔龖龗龞龡 丂丂龔龖龗龞龡
+丂龔龖龗龞龡 丂龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡
+龔龖龗龞龡丂丂 龔龖龗龞龡
+龔龖龗龞龡丂丂丂 龔龖龗龞龡
+SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T6`;
+C1 TRIM(LEADING '丂' FROM `C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+丂丂龔龖龗龞龡 龔龖龗龞龡
+丂龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡丂
+龔龖龗龞龡丂丂 龔龖龗龞龡丂丂
+龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T6`;
+C1 TRIM(BOTH '丂' FROM `C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 龔龖龗龞龡
+丂丂龔龖龗龞龡 龔龖龗龞龡
+丂龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡
+龔龖龗龞龡丂丂 龔龖龗龞龡
+龔龖龗龞龡丂丂丂 龔龖龗龞龡
+SELECT `C1`,TRIM(`C1`) FROM `T6`;
+C1 TRIM(`C1`)
+ 龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 丂丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 丂丂丂龔龖龗龞龡丂丂丂
+丂丂龔龖龗龞龡 丂丂龔龖龗龞龡
+丂龔龖龗龞龡 丂龔龖龗龞龡
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡丂
+龔龖龗龞龡丂丂 龔龖龗龞龡丂丂
+龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T7`;
+C1 TRIM(TRAILING 'カ' FROM `C1`)
+アイウエオ アイウエオ
+アイウエオカ アイウエオ
+アイウエオカカ アイウエオ
+アイウエオカカカ アイウエオ
+カアイウエオ カアイウエオ
+カカアイウエオ カカアイウエオ
+カカカアイウエオ カカカアイウエオ
+カカカアイウエオカカカ カカカアイウエオ
+ アイウエオ アイウエオ
+SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T7`;
+C1 TRIM(LEADING 'カ' FROM `C1`)
+アイウエオ アイウエオ
+アイウエオカ アイウエオカ
+アイウエオカカ アイウエオカカ
+アイウエオカカカ アイウエオカカカ
+カアイウエオ アイウエオ
+カカアイウエオ アイウエオ
+カカカアイウエオ アイウエオ
+カカカアイウエオカカカ アイウエオカカカ
+ アイウエオ アイウエオ
+SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T7`;
+C1 TRIM(BOTH 'カ' FROM `C1`)
+アイウエオ アイウエオ
+アイウエオカ アイウエオ
+アイウエオカカ アイウエオ
+アイウエオカカカ アイウエオ
+カアイウエオ アイウエオ
+カカアイウエオ アイウエオ
+カカカアイウエオ アイウエオ
+カカカアイウエオカカカ アイウエオ
+ アイウエオ アイウエオ
+SELECT `C1`,TRIM(`C1`) FROM `T7`;
+C1 TRIM(`C1`)
+アイウエオ アイウエオ
+アイウエオカ アイウエオカ
+アイウエオカカ アイウエオカカ
+アイウエオカカカ アイウエオカカカ
+カアイウエオ カアイウエオ
+カカアイウエオ カカアイウエオ
+カカカアイウエオ カカカアイウエオ
+カカカアイウエオカカカ カカカアイウエオカカカ
+ アイウエオ アイウエオ
+SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T8`;
+C1 TRIM(TRAILING 'か' FROM `C1`)
+あいうえお あいうえお
+あいうえおか あいうえお
+あいうえおかか あいうえお
+あいうえおかかか あいうえお
+かあいうえお かあいうえお
+かかあいうえお かかあいうえお
+かかかあいうえお かかかあいうえお
+かかかあいうえおかかか かかかあいうえお
+ あいうえお あいうえお
+SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T8`;
+C1 TRIM(LEADING 'か' FROM `C1`)
+あいうえお あいうえお
+あいうえおか あいうえおか
+あいうえおかか あいうえおかか
+あいうえおかかか あいうえおかかか
+かあいうえお あいうえお
+かかあいうえお あいうえお
+かかかあいうえお あいうえお
+かかかあいうえおかかか あいうえおかかか
+ あいうえお あいうえお
+SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T8`;
+C1 TRIM(BOTH 'か' FROM `C1`)
+あいうえお あいうえお
+あいうえおか あいうえお
+あいうえおかか あいうえお
+あいうえおかかか あいうえお
+かあいうえお あいうえお
+かかあいうえお あいうえお
+かかかあいうえお あいうえお
+かかかあいうえおかかか あいうえお
+ あいうえお あいうえお
+SELECT `C1`,TRIM(`C1`) FROM `T8`;
+C1 TRIM(`C1`)
+あいうえお あいうえお
+あいうえおか あいうえおか
+あいうえおかか あいうえおかか
+あいうえおかかか あいうえおかかか
+かあいうえお かあいうえお
+かかあいうえお かかあいうえお
+かかかあいうえお かかかあいうえお
+かかかあいうえおかかか かかかあいうえおかかか
+ あいうえお あいうえお
+SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T9`;
+C1 TRIM(TRAILING '丂' FROM `C1`)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡
+龔龖龗龞龡丂丂 龔龖龗龞龡
+龔龖龗龞龡丂丂丂 龔龖龗龞龡
+丂龔龖龗龞龡 丂龔龖龗龞龡
+丂丂龔龖龗龞龡 丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡 丂丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 丂丂丂龔龖龗龞龡
+ 龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T9`;
+C1 TRIM(LEADING '丂' FROM `C1`)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡丂
+龔龖龗龞龡丂丂 龔龖龗龞龡丂丂
+龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+丂龔龖龗龞龡 龔龖龗龞龡
+丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+ 龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T9`;
+C1 TRIM(BOTH '丂' FROM `C1`)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡
+龔龖龗龞龡丂丂 龔龖龗龞龡
+龔龖龗龞龡丂丂丂 龔龖龗龞龡
+丂龔龖龗龞龡 龔龖龗龞龡
+丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡 龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 龔龖龗龞龡
+ 龔龖龗龞龡 龔龖龗龞龡
+SELECT `C1`,TRIM(`C1`) FROM `T9`;
+C1 TRIM(`C1`)
+龔龖龗龞龡 龔龖龗龞龡
+龔龖龗龞龡丂 龔龖龗龞龡丂
+龔龖龗龞龡丂丂 龔龖龗龞龡丂丂
+龔龖龗龞龡丂丂丂 龔龖龗龞龡丂丂丂
+丂龔龖龗龞龡 丂龔龖龗龞龡
+丂丂龔龖龗龞龡 丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡 丂丂丂龔龖龗龞龡
+丂丂丂龔龖龗龞龡丂丂丂 丂丂丂龔龖龗龞龡丂丂丂
+ 龔龖龗龞龡 龔龖龗龞龡
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_union_ujis.result b/mysql-test/suite/jp/r/jp_union_ujis.result
new file mode 100644
index 00000000..00dc868b
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_union_ujis.result
@@ -0,0 +1,324 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+(SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) UNION (SELECT '') ORDER BY `ã`;
+
+
+
+
+
+
+
+(SELECT '' AS `ã`) UNION (SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) ORDER BY `ã`;
+
+
+
+
+
+
+
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` UNION
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` ORDER BY `ã`;
+ã COUNT(*)
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION SELECT REPEAT(`ã`,5) FROM `ԣ` ORDER BY `ã`;
+
+
+
+ݏݏݏݏ
+
+
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MYISAM;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MYISAM;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MYISAM;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+(SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) UNION (SELECT '') ORDER BY `ã`;
+
+
+
+
+
+
+
+(SELECT '' AS `ã`) UNION (SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) ORDER BY `ã`;
+
+
+
+
+
+
+
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` UNION
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` ORDER BY `ã`;
+ã COUNT(*)
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION SELECT REPEAT(`ã`,5) FROM `ԣ` ORDER BY `ã`;
+
+
+
+ݏݏݏݏ
+
+
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+(SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) UNION (SELECT '') ORDER BY `ã`;
+
+
+
+
+
+
+
+(SELECT '' AS `ã`) UNION (SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) ORDER BY `ã`;
+
+
+
+
+
+
+
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` UNION
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` ORDER BY `ã`;
+ã COUNT(*)
+ 2
+ 2
+ 2
+ 2
+ 2
+ 2
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION SELECT REPEAT(`ã`,5) FROM `ԣ` ORDER BY `ã`;
+
+
+
+ݏݏݏݏ
+
+
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = InnoDB;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MyISAM;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+
+
+
+
+
+
+
+
+
+
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_update_sjis.result b/mysql-test/suite/jp/r/jp_update_sjis.result
new file mode 100644
index 00000000..08d250a1
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_update_sjis.result
@@ -0,0 +1,74 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+UPDATE `sP` SET `bP` = ('');
+UPDATE `sQ` SET `bP` = ('');
+UPDATE `sR` SET `bP` = ('\\\\\');
+UPDATE `sS` SET `bP` = ('');
+UPDATE `sT` SET `bP` = ('');
+UPDATE `sU` SET `bP` = ('\\\\\');
+UPDATE `sV` SET `bP` = ('');
+UPDATE `sW` SET `bP` = ('');
+UPDATE `sX` SET `bP` = ('\\\\\');
+SELECT * FROM `sP`;
+bP
+
+SELECT * FROM `sQ`;
+bP
+
+SELECT * FROM `sR`;
+bP
+\\\\\
+SELECT * FROM `sS`;
+bP
+
+SELECT * FROM `sT`;
+bP
+
+SELECT * FROM `sU`;
+bP
+\\\\\
+SELECT * FROM `sV`;
+bP
+
+SELECT * FROM `sW`;
+bP
+
+SELECT * FROM `sX`;
+bP
+\\\\\
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_update_ucs2.result b/mysql-test/suite/jp/r/jp_update_ucs2.result
new file mode 100644
index 00000000..998126a4
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_update_ucs2.result
@@ -0,0 +1,75 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+ȏɏʏˏ
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+ȏɏʏˏ
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+ȏɏʏˏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_update_ujis.result b/mysql-test/suite/jp/r/jp_update_ujis.result
new file mode 100644
index 00000000..f9764360
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_update_ujis.result
@@ -0,0 +1,74 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+ȏɏʏˏ
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+ȏɏʏˏ
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+
+SELECT * FROM `ԣ`;
+ȏɏʏˏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_update_utf8.result b/mysql-test/suite/jp/r/jp_update_utf8.result
new file mode 100644
index 00000000..15d32145
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_update_utf8.result
@@ -0,0 +1,74 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+UPDATE `T1` SET `C1` = ('カキクケコ');
+UPDATE `T2` SET `C1` = ('かきくけこ');
+UPDATE `T3` SET `C1` = ('齗齘齚齝齞');
+UPDATE `T4` SET `C1` = ('カキクケコ');
+UPDATE `T5` SET `C1` = ('かきくけこ');
+UPDATE `T6` SET `C1` = ('齗齘齚齝齞');
+UPDATE `T7` SET `C1` = ('カキクケコ');
+UPDATE `T8` SET `C1` = ('かきくけこ');
+UPDATE `T9` SET `C1` = ('齗齘齚齝齞');
+SELECT * FROM `T1`;
+C1
+カキクケコ
+SELECT * FROM `T2`;
+C1
+かきくけこ
+SELECT * FROM `T3`;
+C1
+齗齘齚齝齞
+SELECT * FROM `T4`;
+C1
+カキクケコ
+SELECT * FROM `T5`;
+C1
+かきくけこ
+SELECT * FROM `T6`;
+C1
+齗齘齚齝齞
+SELECT * FROM `T7`;
+C1
+カキクケコ
+SELECT * FROM `T8`;
+C1
+かきくけこ
+SELECT * FROM `T9`;
+C1
+齗齘齚齝齞
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/r/jp_where_sjis.result b/mysql-test/suite/jp/r/jp_where_sjis.result
new file mode 100644
index 00000000..536d2a8d
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_where_sjis.result
@@ -0,0 +1,95 @@
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+SELECT * FROM `sP` WHERE `bP` = '';
+bP
+
+SELECT * FROM `sQ` WHERE `bP` = 'E';
+bP
+E
+SELECT * FROM `sR` WHERE `bP` = '\\\\\\\\\\\\\\\\\\\\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sS` WHERE `bP` = '';
+bP
+
+SELECT * FROM `sT` WHERE `bP` = 'E';
+bP
+E
+SELECT * FROM `sU` WHERE `bP` = '\\\\\\\\\\\\\\\\\\\\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+SELECT * FROM `sV` WHERE `bP` = '';
+bP
+
+SELECT * FROM `sW` WHERE `bP` = 'E';
+bP
+E
+SELECT * FROM `sX` WHERE `bP` = '\\\\\\\\\\\\\\\\\\\\';
+bP
+\\\\\\\\\\\\\\\\\\\\
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+CREATE TABLE t1(c1 char(1)) default charset = sjis engine=innodb;
+CREATE TABLE t2(c1 char(1)) default charset = sjis engine=myisam;
+CREATE TABLE t3(c1 char(1)) default charset = sjis engine=MEMORY;
+INSERT INTO t1 VALUES('S'),('s');
+INSERT INTO t2 VALUES('S'),('s');
+INSERT INTO t3 VALUES('S'),('s');
+SELECT * FROM t1 WHERE c1 = 'S';
+c1
+S
+SELECT * FROM t2 WHERE c1 = 'S';
+c1
+S
+SELECT * FROM t3 WHERE c1 = 'S';
+c1
+S
+SELECT * FROM t1 WHERE c1 = 's';
+c1
+s
+SELECT * FROM t2 WHERE c1 = 's';
+c1
+s
+SELECT * FROM t3 WHERE c1 = 's';
+c1
+s
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/r/jp_where_ucs2.result b/mysql-test/suite/jp/r/jp_where_ucs2.result
new file mode 100644
index 00000000..b581ba01
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_where_ucs2.result
@@ -0,0 +1,123 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+INSERT INTO `ԣ` VALUES
+('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+INSERT INTO `ԣ` VALUES
+('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+INSERT INTO `ԣ` VALUES
+('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+ÏďŏƏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_where_ujis.result b/mysql-test/suite/jp/r/jp_where_ujis.result
new file mode 100644
index 00000000..0c4621c3
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_where_ujis.result
@@ -0,0 +1,65 @@
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+SET NAMES ujis;
+SET character_set_database = ujis;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+ÏďŏƏ
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = '';
+
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+ÏďŏƏ
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/r/jp_where_utf8.result b/mysql-test/suite/jp/r/jp_where_utf8.result
new file mode 100644
index 00000000..3adb5733
--- /dev/null
+++ b/mysql-test/suite/jp/r/jp_where_utf8.result
@@ -0,0 +1,65 @@
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+SET NAMES utf8;
+SET character_set_database = utf8;
+CREATE TABLE `T1` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+SELECT * FROM `T1` WHERE `C1` = 'ーアイウエオカキクケコサシスセソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T2` WHERE `C1` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T3` WHERE `C1` = '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T4` WHERE `C1` = 'ーアイウエオカキクケコサシスセソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T5` WHERE `C1` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T6` WHERE `C1` = '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+SELECT * FROM `T7` WHERE `C1` = 'ーアイウエオカキクケコサシスセソ';
+C1
+ーアイウエオカキクケコサシスセソ
+SELECT * FROM `T8` WHERE `C1` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+C1
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+SELECT * FROM `T9` WHERE `C1` = '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+C1
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/std_data/jisx0201_sjis.dat b/mysql-test/suite/jp/std_data/jisx0201_sjis.dat
new file mode 100644
index 00000000..7556c4d3
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0201_sjis.dat
@@ -0,0 +1,10 @@
+ !"#$%&'()*+,-./
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\\]^_
+abcdefghijklmno
+pqrstuvwxyz{|}~
+
+
+
+
diff --git a/mysql-test/suite/jp/std_data/jisx0201_ucs2.dat b/mysql-test/suite/jp/std_data/jisx0201_ucs2.dat
new file mode 100644
index 00000000..777f956a
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0201_ucs2.dat
Binary files differ
diff --git a/mysql-test/suite/jp/std_data/jisx0201_ujis.dat b/mysql-test/suite/jp/std_data/jisx0201_ujis.dat
new file mode 100644
index 00000000..07169ec8
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0201_ujis.dat
@@ -0,0 +1,10 @@
+ !"#$%&'()*+,-./
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\\]^_
+abcdefghijklmno
+pqrstuvwxyz{|}~
+
+
+ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ
+ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ
diff --git a/mysql-test/suite/jp/std_data/jisx0201_utf8.dat b/mysql-test/suite/jp/std_data/jisx0201_utf8.dat
new file mode 100644
index 00000000..3052e4fc
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0201_utf8.dat
@@ -0,0 +1,10 @@
+ !"#$%&'()*+,-./
+0123456789:;<=>?
+@ABCDEFGHIJKLMNO
+PQRSTUVWXYZ[\\]^_
+abcdefghijklmno
+pqrstuvwxyz{|}~
+ 。「」、・ヲァィゥェォャュョッ
+ーアイウエオカキクケコサシスセソ
+タチツテトナニヌネノハヒフヘホマ
+ミムメモヤユヨラリルレロワン゙゚
diff --git a/mysql-test/suite/jp/std_data/jisx0208_sjis.dat b/mysql-test/suite/jp/std_data/jisx0208_sjis.dat
new file mode 100644
index 00000000..767be209
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0208_sjis.dat
@@ -0,0 +1,66 @@
+@@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{]}~
+EEEEE
+EEEEEE
+EEEEEEEEEEEE
+EEȁɁʁˁ́́΁EEEEEEEEEEE
+ځہ܁݁ށ߁EEEEE
+EEEEEEEEEE@
+EEEEEEEEEEEEEEEEOPQR
+STUVWXEEEEEEE`abcdef
+ghijklmnopqrstuvwxyE
+EEEEE
+EEEEEEEEE
+E
+‚ÂĂ
+ƂǂȂɂʂ˂̂͂΂ςЂт҂ӂԂՂւׂ؂
+ڂۂ܂݂ނ߂
+EEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+EEEEEEEEEEEEE
+E
+EEEEEEEEƒÃă
+ƃǃȃɃʃ˃̃̓΃σЃу҃ӃԃՃցEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`EEEEEE
+EEEEEEEEEpqrstuvwxyz
+{|}~
+EEEEEEEEEEEEEEEEEE
+E
+EEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+E
+ˆÈĈ
+ƈLjȈɈʈˈ͈̈ΈψЈш҈ӈԈՈֈ׈؈
+ڈۈ܈݈ވ߈
+EEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+E
+˜ØĘ
+ƘǘȘɘʘ˘̘͘ΘϘИјҘӘԘ՘֘טؘ
+ژۘܘݘޘߘ
+EEEEE
+E@ABCDEFGHIJKLMNOPQR
+STUVWXYZ[\]^_`abcdef
+ghijklmnopqrstuvwxyz
+{|}~
+ꞁEEEEE
+E꤁EEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
+EEEEEEEEEEEEEEEEEEEE
diff --git a/mysql-test/suite/jp/std_data/jisx0208_sjis2.dat b/mysql-test/suite/jp/std_data/jisx0208_sjis2.dat
new file mode 100644
index 00000000..bea8b3cc
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0208_sjis2.dat
@@ -0,0 +1 @@
+\\\\\\\\\\\\\\\\\\\\
diff --git a/mysql-test/suite/jp/std_data/jisx0208_sjis3.dat b/mysql-test/suite/jp/std_data/jisx0208_sjis3.dat
new file mode 100644
index 00000000..b636aacd
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0208_sjis3.dat
@@ -0,0 +1,5 @@
+\\\\\
+\\\\
+\\\
+\\
+\
diff --git a/mysql-test/suite/jp/std_data/jisx0208_ucs2.dat b/mysql-test/suite/jp/std_data/jisx0208_ucs2.dat
new file mode 100644
index 00000000..3ac15368
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0208_ucs2.dat
Binary files differ
diff --git a/mysql-test/suite/jp/std_data/jisx0208_ujis.dat b/mysql-test/suite/jp/std_data/jisx0208_ujis.dat
new file mode 100644
index 00000000..6076ade4
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0208_ujis.dat
@@ -0,0 +1,66 @@
+
+¡áġšơ
+ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ
+ܡޡߡ
+
+
+
+ʢˢ̢͢΢ϢС
+ܢݢޢߢꡦ
+
+
+£ãģţƣ
+ȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ٣ڡ
+
+
+
+¤äĤŤƤ
+Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ
+ܤݤޤߤ
+󡦡
+
+¥åĥťƥ
+ȥɥʥ˥̥ͥΥϥХѥҥӥԥե֥ץإ٥ڥ
+ܥݥޥߥ
+
+
+¦æĦŦƦ
+Ȧɦʦ˦̦ͦΦϦЦѦҦӦԦզ֦צء
+
+
+
+
+
+ѧҧӧԧէ֧קا٧ڧ
+ܧݧާߧ
+񡦡
+
+
+
+
+
+
+°ðİŰư
+Ȱɰʰ˰̰ͰΰϰаѰҰӰ԰հְװذٰڰ
+ܰݰް߰
+
+ϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳ
+ϴϵ϶ϷϸϹϺϻϼϽϾϿ
+
+
+СТУФХЦЧШЩЪЫЬЭЮЯабвг
+дежзийклмноп
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mysql-test/suite/jp/std_data/jisx0208_utf8.dat b/mysql-test/suite/jp/std_data/jisx0208_utf8.dat
new file mode 100644
index 00000000..4ab29099
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0208_utf8.dat
@@ -0,0 +1,66 @@
+  、。,.・:;?!゛゜´`¨^ ̄_ヽ
+ヾゝゞ〃仝々〆〇ー―‐/\〜‖|…‥‘’
+“”()〔〕[]{}〈〉《》「」『』【】
++‐±×÷=≠<>≦≧∞∴♂♀°′″℃¥
+$¢£%#&*@§☆★○●◎◇・・・・・
+・◆□■△▲▽▼※〒→←↑↓〓・・・・・
+・・・・・・∈∋⊆⊇⊂⊃∪∩・・・・・・
+・・∧∨¬⇒⇔∀∃・・・・・・・・・・・
+∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬・・・・・
+・・ʼn♯♭♪†‡¶・・・・◯・・・・ 
+・・・・・・・・・・・・・・・・0123
+456789・・・・・・・ABCDEFG
+HIJKLMNOPQRSTUVWXYZ・
+・・・・・abcdefghijklmno
+pqrstuvwxyz・・・・・・・・・
+・ぁあぃいぅうぇえぉおかがきぎくぐけげこ
+ごさざしじすずせぜそぞただちぢっつづてで
+とどなにぬねのはばぱひびぴふぶぷへべぺほ
+ぼぽまみむめもゃやゅゆょよらりるれろゎわ
+ゐゑをん・・・・・・・・・・・・・・・・
+・ァアィイゥウェエォオカガキギクグケゲコ
+ゴサザシジスズセゼソゾタダチヂッツヅテデ
+トドナニヌネノハバパヒビピフブプヘベペホ
+ボポマミムメモャヤュユョヨラリルレロヮワ
+ヰヱヲンヴヵヶ・・・・・・・・・・・・・
+・ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤ
+ΥΦΧΨΩ・・・・・・・・αβγδεζη
+θικλμνξοπρστυφχψω・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・АБВГДЕЁЖЗИЙКЛМНОПРС
+ТУФХЦЧШЩЪЫЬЭЮЯ・・・・・・
+・・・・・・・・・абвгдеёжзий
+клмнопрстуфхцчшщъыьэ
+юя・・・・・・・・・・・・・・・・・・
+・─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳
+┫┻╋┠┯┨┷┿┝┰┥┸╂・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵
+梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇
+鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異
+移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸
+稲茨芋鰯允印咽員因姻引飲淫胤蔭・・・・・
+・蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏
+牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑
+枠鷲亙亘鰐詫藁蕨椀湾碗腕・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞
+亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛
+佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛
+俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆
+偃假會偕偐偈做偖偬偸傀傚傅傴傲・・・・・
+・鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻
+鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈
+麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝
+黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒
+齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠・・・・・
+・堯槇遙瑤凜熙・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
diff --git a/mysql-test/suite/jp/std_data/jisx0212_ucs2.dat b/mysql-test/suite/jp/std_data/jisx0212_ucs2.dat
new file mode 100644
index 00000000..001c9589
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0212_ucs2.dat
Binary files differ
diff --git a/mysql-test/suite/jp/std_data/jisx0212_ujis.dat b/mysql-test/suite/jp/std_data/jisx0212_ujis.dat
new file mode 100644
index 00000000..40c86458
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0212_ujis.dat
@@ -0,0 +1,40 @@
+
+Ïġ
+
+돢쏢폢
+񡦡
+
+
+
+Ꮶ⏦㏦䏦塦硦鏦ꡦ졦
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏Ρ
+
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏС
+
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏪ⏪㏪䏪只揪珪菪鏪ꏪ돪쏪폪
+
+
+áŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏫ⏫㏫䏫叫揫珫菫鏫ꏫ돫쏫폫
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰
+
+
+ÏďŏƏ
+ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ
+܏ݏޏߏ㡦
+
diff --git a/mysql-test/suite/jp/std_data/jisx0212_utf8.dat b/mysql-test/suite/jp/std_data/jisx0212_utf8.dat
new file mode 100644
index 00000000..3f935425
--- /dev/null
+++ b/mysql-test/suite/jp/std_data/jisx0212_utf8.dat
@@ -0,0 +1,40 @@
+・・・・・・・・・・・・・・・˘ˇ¸˙˝
+・˛˚~΄΅・・・・・・・・¡¦¿・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・ºª©®™
+¤№・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・ΆΈΉΊΪ・Ό・ΎΫ・Ώ・・・
+・άέήίϊΐόςύϋΰώ・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・ЂЃЄЅІЇ
+ЈЉЊЋЌЎЏ・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・ђѓєѕіїјљњћќўџ・・・・・
+・ÆĐ・Ħ・IJ・ŁĿ・ŊØŒ・ŦÞ・・・
+・・・・・・・・・・・・・æđðħıijĸ
+łŀʼnŋøœßŧþ・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
+・ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈË
+ÊĚĖĒĘ・ĜĞĢĠĤÍÌÏÎǏİĪĮĨ
+ĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖ
+ŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙ
+ǕŴÝŸŶŹŽŻ・・・・・・・・・・・・
+・áàäâăǎāąåãćĉčçċďéèë
+êěėēęǵĝğ・ġĥíìïîǐ・īįĩ
+ĵķĺľļńňņñóòöôǒőōõŕřŗ
+śŝšşťţúùüûŭǔűūųůũǘǜǚ
+ǖŵýÿŷźžż・・・・・・・・・・・・
+・丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑
+乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠
+仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众
+伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘
+佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄・・・・・
+・黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪
+鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖
+齗齘齚齝齞齨齩齭齮齯齰齱齳齵齺齽龏龐龑龒
+龔龖龗龞龡龢龣龥・・・・・・・・・・・・
+・・・・・・・・・・・・・・・・・・・・
diff --git a/mysql-test/suite/jp/t/jp_alter_sjis.test b/mysql-test/suite/jp/t/jp_alter_sjis.test
new file mode 100644
index 00000000..ec3abf01
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_alter_sjis.test
@@ -0,0 +1,318 @@
+--source include/have_sjis.inc
+--character_set sjis
+SET NAMES sjis;
+SET character_set_database = sjis;
+--source include/have_innodb.inc
+--disable_warnings
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+--enable_warnings
+
+#
+# Test altering table with Japanese characters in sjis encoding
+#
+
+#
+# Test InnoDB
+#
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=INNODB;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `\\\` VALUES ('\\\\\'),('\\\\\'),('\\\\\');
+
+# Test basic alter operation
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `\\\` ADD `\\\` char(1) FIRST;
+ALTER TABLE `\\\` ADD `\\\` char(1) AFTER `\\\`;
+ALTER TABLE `\\\` ADD `\\\` char(1);
+ALTER TABLE `\\\` ADD INDEX (`\\\`);
+ALTER TABLE `\\\` ADD PRIMARY KEY (`\\\`);
+ALTER TABLE `\\\` ADD UNIQUE (`\\\`);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `\\\` ADD FOREIGN KEY (`\\\`) REFERENCES `\\\`(`\\\`);
+ALTER TABLE `\\\` CHANGE `\\\` `\\` char(1);
+ALTER TABLE `\\\` MODIFY `\\\` char(6);
+
+SELECT * FROM `\\\`;
+DESC `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP PRIMARY KEY;
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+#ALTER TABLE `\\\` DROP FOREIGN KEY `\\\`;
+ALTER TABLE `\\\` DROP `\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+
+SELECT * FROM `\\\`;
+DESC `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+
+#
+# Test MyISAM
+#
+
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MYISAM;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `\\\` VALUES ('\\\\\'),('\\\\\'),('\\\\\');
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `\\\` ADD `\\\` char(1) FIRST;
+ALTER TABLE `\\\` ADD `\\\` char(1) AFTER `\\\`;
+ALTER TABLE `\\\` ADD `\\\` char(1);
+ALTER TABLE `\\\` ADD INDEX (`\\\`);
+ALTER TABLE `\\\` ADD PRIMARY KEY (`\\\`);
+ALTER TABLE `\\\` ADD UNIQUE (`\\\`);
+#ALTER TABLE `\\\` ADD FOREIGN KEY (`\\\`) REFERENCES `\\\`(`\\\`);
+ALTER TABLE `\\\` CHANGE `\\\` `\\` char(1);
+ALTER TABLE `\\\` MODIFY `\\\` char(6);
+
+SELECT * FROM `\\\`;
+DESC `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP PRIMARY KEY;
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+#ALTER TABLE `\\\` DROP FOREIGN KEY `\\\`;
+ALTER TABLE `\\\` DROP `\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+
+SELECT * FROM `\\\`;
+DESC `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+
+#
+# Test MEMORY
+#
+
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(5)) DEFAULT CHARSET = sjis engine=MEMORY;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `\\\` VALUES ('\\\\\'),('\\\\\'),('\\\\\');
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `\\\` ADD `\\\` char(1) FIRST;
+ALTER TABLE `\\\` ADD `\\\` char(1) AFTER `\\\`;
+ALTER TABLE `\\\` ADD `\\\` char(1);
+ALTER TABLE `\\\` ADD INDEX (`\\\`);
+ALTER TABLE `\\\` ADD PRIMARY KEY (`\\\`);
+ALTER TABLE `\\\` ADD UNIQUE (`\\\`);
+#ALTER TABLE `\\\` ADD FOREIGN KEY (`\\\`) REFERENCES `\\\`(`\\\`);
+ALTER TABLE `\\\` CHANGE `\\\` `\\` char(1);
+ALTER TABLE `\\\` MODIFY `\\\` char(6);
+
+SELECT * FROM `\\\`;
+DESC `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+ALTER TABLE `\\\` DROP PRIMARY KEY;
+ALTER TABLE `\\\` DROP INDEX `\\\`;
+#ALTER TABLE `\\\` DROP FOREIGN KEY `\\\`;
+ALTER TABLE `\\\` DROP `\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+ALTER TABLE `\\\` DROP `\\\`;
+
+SELECT * FROM `\\\`;
+DESC `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
diff --git a/mysql-test/suite/jp/t/jp_alter_ucs2.test b/mysql-test/suite/jp/t/jp_alter_ucs2.test
new file mode 100644
index 00000000..24cfed06
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_alter_ucs2.test
@@ -0,0 +1,320 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+--enable_warnings
+
+#
+# Test altering table with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+#
+# Test InnoDB
+#
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=INNODB;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+
+# Test basic alter operation
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `ݏݏ` ADD FOREIGN KEY (``) REFERENCES `ޏޏ`(``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+#ALTER TABLE `ݏݏ` DROP FOREIGN KEY ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+
+#
+# Test MyISAM
+#
+
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MYISAM;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+#ALTER TABLE `ݏݏ` ADD FOREIGN KEY (``) REFERENCES `ޏޏ`(``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+#ALTER TABLE `ݏݏ` DROP FOREIGN KEY ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+
+#
+# Test MEMORY
+#
+
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+#ALTER TABLE `ݏݏ` ADD FOREIGN KEY (``) REFERENCES `ޏޏ`(``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+#ALTER TABLE `ݏݏ` DROP FOREIGN KEY ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
diff --git a/mysql-test/suite/jp/t/jp_alter_ujis.test b/mysql-test/suite/jp/t/jp_alter_ujis.test
new file mode 100644
index 00000000..e397cf66
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_alter_ujis.test
@@ -0,0 +1,320 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+
+--disable_warnings
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+--enable_warnings
+
+#
+# Test altering table with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+#
+# Test InnoDB
+#
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ujis engine=INNODB;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+
+# Test basic alter operation
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `ݏݏ` ADD FOREIGN KEY (``) REFERENCES `ޏޏ`(``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+#ALTER TABLE `ݏݏ` DROP FOREIGN KEY ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+
+#
+# Test MyISAM
+#
+
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MYISAM;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+#ALTER TABLE `ݏݏ` ADD FOREIGN KEY (``) REFERENCES `ޏޏ`(``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+#ALTER TABLE `ݏݏ` DROP FOREIGN KEY ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+
+#
+# Test MEMORY
+#
+
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(5)) DEFAULT CHARSET = ujis engine=MEMORY;
+
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `` VALUES (''),(''),('');
+INSERT INTO `ݏݏ` VALUES (''),(''),('');
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` ADD `` char(1) FIRST;
+ALTER TABLE `` ADD `` char(1) AFTER ``;
+ALTER TABLE `` ADD `` char(1);
+ALTER TABLE `` ADD INDEX (``);
+ALTER TABLE `` ADD PRIMARY KEY (``);
+ALTER TABLE `` ADD UNIQUE (``);
+#ALTER TABLE `` ADD FOREIGN KEY (``) REFERENCES ``(``);
+ALTER TABLE `` CHANGE `` `` char(1);
+ALTER TABLE `` MODIFY `` char(6);
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `` DROP INDEX ``;
+ALTER TABLE `` DROP PRIMARY KEY;
+ALTER TABLE `` DROP INDEX ``;
+#ALTER TABLE `` DROP FOREIGN KEY ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+ALTER TABLE `` DROP ``;
+
+SELECT * FROM ``;
+DESC ``;
+SHOW CREATE TABLE ``;
+
+ALTER TABLE `ݏݏ` ADD `` char(1) FIRST;
+ALTER TABLE `ݏݏ` ADD `` char(1) AFTER ``;
+ALTER TABLE `ݏݏ` ADD `` char(1);
+ALTER TABLE `ݏݏ` ADD INDEX (``);
+ALTER TABLE `ݏݏ` ADD PRIMARY KEY (``);
+ALTER TABLE `ݏݏ` ADD UNIQUE (``);
+#ALTER TABLE `ݏݏ` ADD FOREIGN KEY (``) REFERENCES `ޏޏ`(``);
+ALTER TABLE `ݏݏ` CHANGE `` `` char(1);
+ALTER TABLE `ݏݏ` MODIFY `` char(6);
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+ALTER TABLE `ݏݏ` DROP PRIMARY KEY;
+ALTER TABLE `ݏݏ` DROP INDEX ``;
+#ALTER TABLE `ݏݏ` DROP FOREIGN KEY ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+ALTER TABLE `ݏݏ` DROP ``;
+
+SELECT * FROM `ݏݏ`;
+DESC `ݏݏ`;
+SHOW CREATE TABLE `ݏݏ`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
diff --git a/mysql-test/suite/jp/t/jp_alter_utf8.test b/mysql-test/suite/jp/t/jp_alter_utf8.test
new file mode 100644
index 00000000..fc98e20a
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_alter_utf8.test
@@ -0,0 +1,319 @@
+--disable_warnings
+DROP TABLE IF EXISTS `アアア`;
+DROP TABLE IF EXISTS `イイイ`;
+DROP TABLE IF EXISTS `あああ`;
+DROP TABLE IF EXISTS `いいい`;
+DROP TABLE IF EXISTS `龖龖龖`;
+DROP TABLE IF EXISTS `龗龗龗`;
+--enable_warnings
+
+#
+# Test altering table with Japanese characters in utf8 encoding
+#
+
+--source include/have_utf8.inc
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+--source include/have_innodb.inc
+
+#
+# Test InnoDB
+#
+CREATE TABLE `アアア`(`キキキ` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `イイイ`(`ケケケ` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `あああ`(`ききき` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `いいい`(`けけけ` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龗龗龗`(`乚乚乚` char(5)) DEFAULT CHARSET = utf8 engine=INNODB;
+
+INSERT INTO `アアア` VALUES ('アアアアア'),('イイイイイ'),('ウウウウウ');
+INSERT INTO `あああ` VALUES ('あああああ'),('いいいいい'),('ううううう');
+INSERT INTO `龖龖龖` VALUES ('丂丂丂丂丂'),('丄丄丄丄丄'),('丅丅丅丅丅');
+
+# Test basic alter operation
+
+ALTER TABLE `アアア` ADD `カカカ` char(1) FIRST;
+ALTER TABLE `アアア` ADD `ククク` char(1) AFTER `キキキ`;
+ALTER TABLE `アアア` ADD `ケケケ` char(1);
+ALTER TABLE `アアア` ADD INDEX (`カカカ`);
+ALTER TABLE `アアア` ADD PRIMARY KEY (`キキキ`);
+ALTER TABLE `アアア` ADD UNIQUE (`ククク`);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `アアア` ADD FOREIGN KEY (`ケケケ`) REFERENCES `イイイ`(`ケケケ`);
+ALTER TABLE `アアア` CHANGE `カカカ` `カカ` char(1);
+ALTER TABLE `アアア` MODIFY `キキキ` char(6);
+
+SELECT * FROM `アアア`;
+DESC `アアア`;
+SHOW CREATE TABLE `アアア`;
+
+ALTER TABLE `アアア` DROP INDEX `カカカ`;
+ALTER TABLE `アアア` DROP PRIMARY KEY;
+ALTER TABLE `アアア` DROP INDEX `ククク`;
+#ALTER TABLE `アアア` DROP FOREIGN KEY `ケケケ`;
+ALTER TABLE `アアア` DROP `カカ`;
+ALTER TABLE `アアア` DROP `ククク`;
+ALTER TABLE `アアア` DROP `ケケケ`;
+SELECT * FROM `アアア`;
+DESC `アアア`;
+SHOW CREATE TABLE `アアア`;
+
+ALTER TABLE `あああ` ADD `かかか` char(1) FIRST;
+ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`;
+ALTER TABLE `あああ` ADD `けけけ` char(1);
+ALTER TABLE `あああ` ADD INDEX (`かかか`);
+ALTER TABLE `あああ` ADD PRIMARY KEY (`ききき`);
+ALTER TABLE `あああ` ADD UNIQUE (`くくく`);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `あああ` ADD FOREIGN KEY (`けけけ`) REFERENCES `いいい`(`けけけ`);
+ALTER TABLE `あああ` CHANGE `かかか` `かか` char(1);
+ALTER TABLE `あああ` MODIFY `ききき` char(6);
+
+SELECT * FROM `あああ`;
+DESC `あああ`;
+SHOW CREATE TABLE `あああ`;
+
+ALTER TABLE `あああ` DROP INDEX `かかか`;
+ALTER TABLE `あああ` DROP PRIMARY KEY;
+ALTER TABLE `あああ` DROP INDEX `くくく`;
+#ALTER TABLE `あああ` DROP FOREIGN KEY `けけけ`;
+ALTER TABLE `あああ` DROP `かか`;
+ALTER TABLE `あああ` DROP `くくく`;
+ALTER TABLE `あああ` DROP `けけけ`;
+
+SELECT * FROM `あああ`;
+DESC `あああ`;
+SHOW CREATE TABLE `あああ`;
+
+ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
+ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
+ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1);
+ALTER TABLE `龖龖龖` ADD INDEX (`丄丄丄`);
+ALTER TABLE `龖龖龖` ADD PRIMARY KEY (`丂丂丂`);
+ALTER TABLE `龖龖龖` ADD UNIQUE (`丅丅丅`);
+#Multi-byte field name is not allowed for FOREIGN KEY As of 4.1.4
+#ALTER TABLE `龖龖龖` ADD FOREIGN KEY (`乚乚乚`) REFERENCES `龗龗龗`(`乚乚乚`);
+ALTER TABLE `龖龖龖` CHANGE `丄丄丄` `丄丄` char(1);
+ALTER TABLE `龖龖龖` MODIFY `丂丂丂` char(6);
+
+SELECT * FROM `龖龖龖`;
+DESC `龖龖龖`;
+SHOW CREATE TABLE `龖龖龖`;
+
+ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`;
+ALTER TABLE `龖龖龖` DROP PRIMARY KEY;
+ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`;
+#ALTER TABLE `龖龖龖` DROP FOREIGN KEY `乚乚乚`;
+ALTER TABLE `龖龖龖` DROP `丄丄`;
+ALTER TABLE `龖龖龖` DROP `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `乚乚乚`;
+
+SELECT * FROM `龖龖龖`;
+DESC `龖龖龖`;
+SHOW CREATE TABLE `龖龖龖`;
+
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+
+#
+# Test MyISAM
+#
+
+CREATE TABLE `アアア`(`キキキ` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `イイイ`(`ケケケ` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `あああ`(`ききき` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `いいい`(`けけけ` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+CREATE TABLE `龗龗龗`(`乚乚乚` char(5)) DEFAULT CHARSET = utf8 engine=MYISAM;
+
+INSERT INTO `アアア` VALUES ('アアアアア'),('イイイイイ'),('ウウウウウ');
+INSERT INTO `あああ` VALUES ('あああああ'),('いいいいい'),('ううううう');
+INSERT INTO `龖龖龖` VALUES ('丂丂丂丂丂'),('丄丄丄丄丄'),('丅丅丅丅丅');
+
+ALTER TABLE `アアア` ADD `カカカ` char(1) FIRST;
+ALTER TABLE `アアア` ADD `ククク` char(1) AFTER `キキキ`;
+ALTER TABLE `アアア` ADD `ケケケ` char(1);
+ALTER TABLE `アアア` ADD INDEX (`カカカ`);
+ALTER TABLE `アアア` ADD PRIMARY KEY (`キキキ`);
+ALTER TABLE `アアア` ADD UNIQUE (`ククク`);
+#ALTER TABLE `アアア` ADD FOREIGN KEY (`ケケケ`) REFERENCES `イイイ`(`ケケケ`);
+ALTER TABLE `アアア` CHANGE `カカカ` `カカ` char(1);
+ALTER TABLE `アアア` MODIFY `キキキ` char(6);
+
+SELECT * FROM `アアア`;
+DESC `アアア`;
+SHOW CREATE TABLE `アアア`;
+
+ALTER TABLE `アアア` DROP INDEX `カカカ`;
+ALTER TABLE `アアア` DROP PRIMARY KEY;
+ALTER TABLE `アアア` DROP INDEX `ククク`;
+#ALTER TABLE `アアア` DROP FOREIGN KEY `ケケケ`;
+ALTER TABLE `アアア` DROP `カカ`;
+ALTER TABLE `アアア` DROP `ククク`;
+ALTER TABLE `アアア` DROP `ケケケ`;
+SELECT * FROM `アアア`;
+DESC `アアア`;
+SHOW CREATE TABLE `アアア`;
+
+ALTER TABLE `あああ` ADD `かかか` char(1) FIRST;
+ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`;
+ALTER TABLE `あああ` ADD `けけけ` char(1);
+ALTER TABLE `あああ` ADD INDEX (`かかか`);
+ALTER TABLE `あああ` ADD PRIMARY KEY (`ききき`);
+ALTER TABLE `あああ` ADD UNIQUE (`くくく`);
+#ALTER TABLE `あああ` ADD FOREIGN KEY (`けけけ`) REFERENCES `いいい`(`けけけ`);
+ALTER TABLE `あああ` CHANGE `かかか` `かか` char(1);
+ALTER TABLE `あああ` MODIFY `ききき` char(6);
+
+SELECT * FROM `あああ`;
+DESC `あああ`;
+SHOW CREATE TABLE `あああ`;
+
+ALTER TABLE `あああ` DROP INDEX `かかか`;
+ALTER TABLE `あああ` DROP PRIMARY KEY;
+ALTER TABLE `あああ` DROP INDEX `くくく`;
+#ALTER TABLE `あああ` DROP FOREIGN KEY `けけけ`;
+ALTER TABLE `あああ` DROP `かか`;
+ALTER TABLE `あああ` DROP `くくく`;
+ALTER TABLE `あああ` DROP `けけけ`;
+
+SELECT * FROM `あああ`;
+DESC `あああ`;
+SHOW CREATE TABLE `あああ`;
+
+ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
+ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
+ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1);
+ALTER TABLE `龖龖龖` ADD INDEX (`丄丄丄`);
+ALTER TABLE `龖龖龖` ADD PRIMARY KEY (`丂丂丂`);
+ALTER TABLE `龖龖龖` ADD UNIQUE (`丅丅丅`);
+#ALTER TABLE `龖龖龖` ADD FOREIGN KEY (`乚乚乚`) REFERENCES `龗龗龗`(`乚乚乚`);
+ALTER TABLE `龖龖龖` CHANGE `丄丄丄` `丄丄` char(1);
+ALTER TABLE `龖龖龖` MODIFY `丂丂丂` char(6);
+
+SELECT * FROM `龖龖龖`;
+DESC `龖龖龖`;
+SHOW CREATE TABLE `龖龖龖`;
+
+ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`;
+ALTER TABLE `龖龖龖` DROP PRIMARY KEY;
+ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`;
+#ALTER TABLE `龖龖龖` DROP FOREIGN KEY `乚乚乚`;
+ALTER TABLE `龖龖龖` DROP `丄丄`;
+ALTER TABLE `龖龖龖` DROP `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `乚乚乚`;
+
+SELECT * FROM `龖龖龖`;
+DESC `龖龖龖`;
+SHOW CREATE TABLE `龖龖龖`;
+
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+
+#
+# Test MEMORY
+#
+
+CREATE TABLE `アアア`(`キキキ` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `イイイ`(`ケケケ` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `あああ`(`ききき` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `いいい`(`けけけ` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龗龗龗`(`乚乚乚` char(5)) DEFAULT CHARSET = utf8 engine=MEMORY;
+
+INSERT INTO `アアア` VALUES ('アアアアア'),('イイイイイ'),('ウウウウウ');
+INSERT INTO `あああ` VALUES ('あああああ'),('いいいいい'),('ううううう');
+INSERT INTO `龖龖龖` VALUES ('丂丂丂丂丂'),('丄丄丄丄丄'),('丅丅丅丅丅');
+
+ALTER TABLE `アアア` ADD `カカカ` char(1) FIRST;
+ALTER TABLE `アアア` ADD `ククク` char(1) AFTER `キキキ`;
+ALTER TABLE `アアア` ADD `ケケケ` char(1);
+ALTER TABLE `アアア` ADD INDEX (`カカカ`);
+ALTER TABLE `アアア` ADD PRIMARY KEY (`キキキ`);
+ALTER TABLE `アアア` ADD UNIQUE (`ククク`);
+#ALTER TABLE `アアア` ADD FOREIGN KEY (`ケケケ`) REFERENCES `イイイ`(`ケケケ`);
+ALTER TABLE `アアア` CHANGE `カカカ` `カカ` char(1);
+ALTER TABLE `アアア` MODIFY `キキキ` char(6);
+
+SELECT * FROM `アアア`;
+DESC `アアア`;
+SHOW CREATE TABLE `アアア`;
+
+ALTER TABLE `アアア` DROP INDEX `カカカ`;
+ALTER TABLE `アアア` DROP PRIMARY KEY;
+ALTER TABLE `アアア` DROP INDEX `ククク`;
+#ALTER TABLE `アアア` DROP FOREIGN KEY `ケケケ`;
+ALTER TABLE `アアア` DROP `カカ`;
+ALTER TABLE `アアア` DROP `ククク`;
+ALTER TABLE `アアア` DROP `ケケケ`;
+SELECT * FROM `アアア`;
+DESC `アアア`;
+SHOW CREATE TABLE `アアア`;
+
+ALTER TABLE `あああ` ADD `かかか` char(1) FIRST;
+ALTER TABLE `あああ` ADD `くくく` char(1) AFTER `ききき`;
+ALTER TABLE `あああ` ADD `けけけ` char(1);
+ALTER TABLE `あああ` ADD INDEX (`かかか`);
+ALTER TABLE `あああ` ADD PRIMARY KEY (`ききき`);
+ALTER TABLE `あああ` ADD UNIQUE (`くくく`);
+#ALTER TABLE `あああ` ADD FOREIGN KEY (`けけけ`) REFERENCES `いいい`(`けけけ`);
+ALTER TABLE `あああ` CHANGE `かかか` `かか` char(1);
+ALTER TABLE `あああ` MODIFY `ききき` char(6);
+
+SELECT * FROM `あああ`;
+DESC `あああ`;
+SHOW CREATE TABLE `あああ`;
+
+ALTER TABLE `あああ` DROP INDEX `かかか`;
+ALTER TABLE `あああ` DROP PRIMARY KEY;
+ALTER TABLE `あああ` DROP INDEX `くくく`;
+#ALTER TABLE `あああ` DROP FOREIGN KEY `けけけ`;
+ALTER TABLE `あああ` DROP `かか`;
+ALTER TABLE `あああ` DROP `くくく`;
+ALTER TABLE `あああ` DROP `けけけ`;
+
+SELECT * FROM `あああ`;
+DESC `あああ`;
+SHOW CREATE TABLE `あああ`;
+
+ALTER TABLE `龖龖龖` ADD `丄丄丄` char(1) FIRST;
+ALTER TABLE `龖龖龖` ADD `丅丅丅` char(1) AFTER `丂丂丂`;
+ALTER TABLE `龖龖龖` ADD `乚乚乚` char(1);
+ALTER TABLE `龖龖龖` ADD INDEX (`丄丄丄`);
+ALTER TABLE `龖龖龖` ADD PRIMARY KEY (`丂丂丂`);
+ALTER TABLE `龖龖龖` ADD UNIQUE (`丅丅丅`);
+#ALTER TABLE `龖龖龖` ADD FOREIGN KEY (`乚乚乚`) REFERENCES `龗龗龗`(`乚乚乚`);
+ALTER TABLE `龖龖龖` CHANGE `丄丄丄` `丄丄` char(1);
+ALTER TABLE `龖龖龖` MODIFY `丂丂丂` char(6);
+
+SELECT * FROM `龖龖龖`;
+DESC `龖龖龖`;
+SHOW CREATE TABLE `龖龖龖`;
+
+ALTER TABLE `龖龖龖` DROP INDEX `丄丄丄`;
+ALTER TABLE `龖龖龖` DROP PRIMARY KEY;
+ALTER TABLE `龖龖龖` DROP INDEX `丅丅丅`;
+#ALTER TABLE `龖龖龖` DROP FOREIGN KEY `乚乚乚`;
+ALTER TABLE `龖龖龖` DROP `丄丄`;
+ALTER TABLE `龖龖龖` DROP `丅丅丅`;
+ALTER TABLE `龖龖龖` DROP `乚乚乚`;
+
+SELECT * FROM `龖龖龖`;
+DESC `龖龖龖`;
+SHOW CREATE TABLE `龖龖龖`;
+
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
diff --git a/mysql-test/suite/jp/t/jp_charlength_sjis.test b/mysql-test/suite/jp/t/jp_charlength_sjis.test
new file mode 100644
index 00000000..91bdb272
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charlength_sjis.test
@@ -0,0 +1,66 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test CHAR_LENGTH() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sP`;
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sQ`;
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sR`;
+
+#MyISAM
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sS`;
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sT`;
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sV`;
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sW`;
+SELECT `bP`, CHAR_LENGTH(`bP`) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_charlength_ucs2.test b/mysql-test/suite/jp/t/jp_charlength_ucs2.test
new file mode 100644
index 00000000..4376ebbd
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charlength_ucs2.test
@@ -0,0 +1,67 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test CHAR_LENGTH() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_charlength_ujis.test b/mysql-test/suite/jp/t/jp_charlength_ujis.test
new file mode 100644
index 00000000..3f55e8ee
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charlength_ujis.test
@@ -0,0 +1,66 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test CHAR_LENGTH() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, CHAR_LENGTH(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_charlength_utf8.test b/mysql-test/suite/jp/t/jp_charlength_utf8.test
new file mode 100644
index 00000000..9e88bd98
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charlength_utf8.test
@@ -0,0 +1,65 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test CHAR_LENGTH() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T1`;
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T2`;
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T3`;
+
+#MyISAM
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T4`;
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T5`;
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T7`;
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T8`;
+SELECT `C1`, CHAR_LENGTH(`C1`) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_charset_sjis.test b/mysql-test/suite/jp/t/jp_charset_sjis.test
new file mode 100644
index 00000000..4cde0848
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charset_sjis.test
@@ -0,0 +1,109 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test CHARSET() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(20)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+
+#InnoDB
+SELECT DISTINCT CHARSET(`bP`) FROM `sP`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sQ`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sR`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sP`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sP`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sP`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sP`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sQ`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sQ`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sQ`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sQ`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sR`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sR`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sR`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sR`;
+
+#MyISAM
+SELECT DISTINCT CHARSET(`bP`) FROM `sS`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sT`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sU`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sS`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sS`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sS`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sS`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sT`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sT`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sT`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sT`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sU`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sU`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sU`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sU`;
+
+#MEMORY
+SELECT DISTINCT CHARSET(`bP`) FROM `sV`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sW`;
+SELECT DISTINCT CHARSET(`bP`) FROM `sX`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sV`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sV`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sV`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sV`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sW`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sW`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sW`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sW`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING utf8)) FROM `sX`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ucs2)) FROM `sX`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING sjis)) FROM `sX`;
+SELECT DISTINCT CHARSET(CONVERT(`bP` USING ujis)) FROM `sX`;
+
+drop table `sP`;
+drop table `sQ`;
+drop table `sR`;
+drop table `sS`;
+drop table `sT`;
+drop table `sU`;
+drop table `sV`;
+drop table `sW`;
+drop table `sX`;
diff --git a/mysql-test/suite/jp/t/jp_charset_ucs2.test b/mysql-test/suite/jp/t/jp_charset_ucs2.test
new file mode 100644
index 00000000..8427d721
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charset_ucs2.test
@@ -0,0 +1,174 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test CHARSET() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+#Insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+#InnoDB
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+
+#MyISAM
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+
+#MEMORY
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_charset_ujis.test b/mysql-test/suite/jp/t/jp_charset_ujis.test
new file mode 100644
index 00000000..6e80162c
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charset_ujis.test
@@ -0,0 +1,110 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test CHARSET() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+
+#InnoDB
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+
+#MyISAM
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+
+#MEMORY
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(`ã`) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING utf8)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ucs2)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING sjis)) FROM `ԣ`;
+SELECT DISTINCT CHARSET(CONVERT(`ã` USING ujis)) FROM `ԣ`;
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_charset_utf8.test b/mysql-test/suite/jp/t/jp_charset_utf8.test
new file mode 100644
index 00000000..e02c035f
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_charset_utf8.test
@@ -0,0 +1,110 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test CHARSET() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+
+#InnoDB
+SELECT DISTINCT CHARSET(`C1`) FROM `T1`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T2`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T3`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T1`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T1`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T1`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T1`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T2`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T2`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T2`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T2`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T3`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T3`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T3`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T3`;
+
+#MyISAM
+SELECT DISTINCT CHARSET(`C1`) FROM `T4`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T5`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T6`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T4`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T4`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T4`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T4`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T5`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T5`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T5`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T5`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T6`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T6`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T6`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T6`;
+
+#MEMORY
+SELECT DISTINCT CHARSET(`C1`) FROM `T7`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T8`;
+SELECT DISTINCT CHARSET(`C1`) FROM `T9`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T7`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T7`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T7`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T7`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T8`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T8`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T8`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T8`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING utf8)) FROM `T9`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ucs2)) FROM `T9`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING sjis)) FROM `T9`;
+SELECT DISTINCT CHARSET(CONVERT(`C1` USING ujis)) FROM `T9`;
+
+drop table `T1`;
+drop table `T2`;
+drop table `T3`;
+drop table `T4`;
+drop table `T5`;
+drop table `T6`;
+drop table `T7`;
+drop table `T8`;
+drop table `T9`;
diff --git a/mysql-test/suite/jp/t/jp_convert_sjis.test b/mysql-test/suite/jp/t/jp_convert_sjis.test
new file mode 100644
index 00000000..ccbce35b
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_convert_sjis.test
@@ -0,0 +1,93 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--character_set sjis
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test CONVERT() function with Japanese character in sjis encoding
+#
+
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+
+#InnoDB
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sP`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sP`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sP`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sQ`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sQ`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sQ`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sR`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sR`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sR`;
+
+#MyISAM
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sS`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sS`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sS`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sT`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sT`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sT`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sU`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sU`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sV`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sV`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sV`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sW`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sW`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sW`;
+SELECT `bP`, CONVERT(`bP` using utf8) FROM `sX`;
+SELECT `bP`, CONVERT(`bP` using ucs2) FROM `sX`;
+SELECT `bP`, CONVERT(`bP` using ujis) FROM `sX`;
+
+drop table `sP`;
+drop table `sQ`;
+drop table `sR`;
+drop table `sS`;
+drop table `sT`;
+drop table `sU`;
+drop table `sV`;
+drop table `sW`;
+drop table `sX`;
diff --git a/mysql-test/suite/jp/t/jp_convert_ucs2.test b/mysql-test/suite/jp/t/jp_convert_ucs2.test
new file mode 100644
index 00000000..cf796223
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_convert_ucs2.test
@@ -0,0 +1,161 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test CONVERT() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+#Insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+#InnoDB
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_convert_ujis.test b/mysql-test/suite/jp/t/jp_convert_ujis.test
new file mode 100644
index 00000000..f15fee49
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_convert_ujis.test
@@ -0,0 +1,95 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test CONVERT() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+
+#InnoDB
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using utf8) FROM `ԣ`;
+SELECT `ã`, CONVERT(`ã` using ucs2) FROM `ԣ`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `ã`, CONVERT(`ã` using sjis) FROM `ԣ`;
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_convert_utf8.test b/mysql-test/suite/jp/t/jp_convert_utf8.test
new file mode 100644
index 00000000..7a230495
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_convert_utf8.test
@@ -0,0 +1,94 @@
+--source include/have_sjis.inc
+--source include/have_ucs2.inc
+--source include/have_ujis.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test CONVERT() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+ LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+
+#InnoDB
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T1`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T1`;
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T1`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T2`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T2`;
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T2`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T3`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T3`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T3`;
+
+#MyISAM
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T4`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T4`;
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T4`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T5`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T5`;
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T5`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T6`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T6`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T7`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T7`;
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T7`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T8`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T8`;
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T8`;
+SELECT `C1`, CONVERT(`C1` using ujis) FROM `T9`;
+SELECT `C1`, CONVERT(`C1` using ucs2) FROM `T9`;
+# The result will get garbled because jisx0212 is not included in sjis
+SELECT `C1`, CONVERT(`C1` using sjis) FROM `T9`;
+
+drop table `T1`;
+drop table `T2`;
+drop table `T3`;
+drop table `T4`;
+drop table `T5`;
+drop table `T6`;
+drop table `T7`;
+drop table `T8`;
+drop table `T9`;
diff --git a/mysql-test/suite/jp/t/jp_create_db_sjis.test b/mysql-test/suite/jp/t/jp_create_db_sjis.test
new file mode 100644
index 00000000..5458e6f0
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_db_sjis.test
@@ -0,0 +1,27 @@
+--source include/have_sjis.inc
+--character_set sjis
+SET NAMES sjis;
+SET character_set_database = sjis;
+--disable_warnings
+drop database if exists `ݺ`;
+drop database if exists `{`;
+drop database if exists `\\\`;
+--enable_warnings
+
+#
+# Test Creating databases using Japanese charact for DB name in ujis encoding
+#
+
+CREATE DATABASE `ݺ`;
+CREATE DATABASE `{`;
+CREATE DATABASE `\\\`;
+
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+
+USE `ݺ`;
+USE `{`;
+USE `\\\`;
+
+DROP DATABASE `ݺ`;
+DROP DATABASE `{`;
+DROP DATABASE `\\\`;
diff --git a/mysql-test/suite/jp/t/jp_create_db_ucs2.test b/mysql-test/suite/jp/t/jp_create_db_ucs2.test
new file mode 100644
index 00000000..a3f64d1e
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_db_ucs2.test
@@ -0,0 +1,29 @@
+--source include/have_ucs2.inc
+
+--disable_warnings
+drop database if exists `ƎΎݎ`;
+drop database if exists `ܸ`;
+drop database if exists `܏ݏ`;
+--enable_warnings
+
+#
+# Test Creating databases using Japanese charact for DB name in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET character_set_server = ucs2;
+
+CREATE DATABASE `ƎΎݎ`;
+CREATE DATABASE `ܸ`;
+CREATE DATABASE `܏ݏ`;
+
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+
+USE `ƎΎݎ`;
+USE `ܸ`;
+USE `܏ݏ`;
+
+DROP DATABASE `ƎΎݎ`;
+DROP DATABASE `ܸ`;
+DROP DATABASE `܏ݏ`;
diff --git a/mysql-test/suite/jp/t/jp_create_db_ujis.test b/mysql-test/suite/jp/t/jp_create_db_ujis.test
new file mode 100644
index 00000000..514745aa
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_db_ujis.test
@@ -0,0 +1,28 @@
+--source include/have_ujis.inc
+
+--disable_warnings
+drop database if exists `ƎΎݎ`;
+drop database if exists `ܸ`;
+drop database if exists `܏ݏ`;
+--enable_warnings
+
+#
+# Test Creating databases using Japanese charact for DB name in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE DATABASE `ƎΎݎ`;
+CREATE DATABASE `ܸ`;
+CREATE DATABASE `܏ݏ`;
+
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+
+USE `ƎΎݎ`;
+USE `ܸ`;
+USE `܏ݏ`;
+
+DROP DATABASE `ƎΎݎ`;
+DROP DATABASE `ܸ`;
+DROP DATABASE `܏ݏ`;
diff --git a/mysql-test/suite/jp/t/jp_create_db_utf8.test b/mysql-test/suite/jp/t/jp_create_db_utf8.test
new file mode 100644
index 00000000..8617af57
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_db_utf8.test
@@ -0,0 +1,27 @@
+--source include/have_utf8.inc
+--disable_warnings
+drop database if exists `ニホンゴ`;
+drop database if exists `日本語`;
+drop database if exists `龔龖龗`;
+--enable_warnings
+
+#
+# Test Creating databases using Japanese charact for DB name in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE DATABASE `ニホンゴ`;
+CREATE DATABASE `日本語`;
+CREATE DATABASE `龔龖龗`;
+
+SELECT schema_name from information_schema.schemata where schema_name <> 'mtr' ORDER BY schema_name;
+
+USE `ニホンゴ`;
+USE `日本語`;
+USE `龔龖龗`;
+
+DROP DATABASE `ニホンゴ`;
+DROP DATABASE `日本語`;
+DROP DATABASE `龔龖龗`;
diff --git a/mysql-test/suite/jp/t/jp_create_tbl_sjis.test b/mysql-test/suite/jp/t/jp_create_tbl_sjis.test
new file mode 100644
index 00000000..3a799958
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_tbl_sjis.test
@@ -0,0 +1,238 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+SET NAMES sjis;
+SET character_set_database = sjis;
+--disable_warnings
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+DROP TABLE IF EXISTS `\\\`;
+--enable_warnings
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\`char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=INNODB;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\`char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MyISAM;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `\\\`(`\\\`char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+CREATE TEMPORARY TABLE `\\\`(`\\\` char(1)) DEFAULT CHARSET = sjis engine=MEMORY;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+DESC `\\\`;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+SHOW CREATE TABLE `\\\`;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
+DROP TABLE `\\\`;
diff --git a/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test b/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test
new file mode 100644
index 00000000..986cc50b
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_tbl_ucs2.test
@@ -0,0 +1,243 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+DROP TABLE IF EXISTS `ߏߏ`;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+--enable_warnings
+
+#
+# Test creating table with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=INNODB;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `ݏݏ`;
+DESC `ޏޏ`;
+DESC `ߏߏ`;
+DESC ``;
+DESC ``;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `ݏݏ`;
+SHOW CREATE TABLE `ޏޏ`;
+SHOW CREATE TABLE `ߏߏ`;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MyISAM;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `ݏݏ`;
+DESC `ޏޏ`;
+DESC `ߏߏ`;
+DESC ``;
+DESC ``;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `ݏݏ`;
+SHOW CREATE TABLE `ޏޏ`;
+SHOW CREATE TABLE `ߏߏ`;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ucs2 engine=MEMORY;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `ݏݏ`;
+DESC `ޏޏ`;
+DESC `ߏߏ`;
+DESC ``;
+DESC ``;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `ݏݏ`;
+SHOW CREATE TABLE `ޏޏ`;
+SHOW CREATE TABLE `ߏߏ`;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
diff --git a/mysql-test/suite/jp/t/jp_create_tbl_ujis.test b/mysql-test/suite/jp/t/jp_create_tbl_ujis.test
new file mode 100644
index 00000000..c82d1186
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_tbl_ujis.test
@@ -0,0 +1,243 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS `ݏݏ`;
+DROP TABLE IF EXISTS `ޏޏ`;
+DROP TABLE IF EXISTS `ߏߏ`;
+DROP TABLE IF EXISTS ``;
+DROP TABLE IF EXISTS ``;
+--enable_warnings
+
+#
+# Test creating table with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=INNODB;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `ݏݏ`;
+DESC `ޏޏ`;
+DESC `ߏߏ`;
+DESC ``;
+DESC ``;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `ݏݏ`;
+SHOW CREATE TABLE `ޏޏ`;
+SHOW CREATE TABLE `ߏߏ`;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MyISAM;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `ݏݏ`;
+DESC `ޏޏ`;
+DESC `ߏߏ`;
+DESC ``;
+DESC ``;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `ݏݏ`;
+SHOW CREATE TABLE `ޏޏ`;
+SHOW CREATE TABLE `ߏߏ`;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
+
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ݏݏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ޏޏ`(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ߏߏ`(``char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+CREATE TEMPORARY TABLE ``(`` char(1)) DEFAULT CHARSET = ujis engine=MEMORY;
+
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC ``;
+DESC `ݏݏ`;
+DESC `ޏޏ`;
+DESC `ߏߏ`;
+DESC ``;
+DESC ``;
+
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE `ݏݏ`;
+SHOW CREATE TABLE `ޏޏ`;
+SHOW CREATE TABLE `ߏߏ`;
+SHOW CREATE TABLE ``;
+SHOW CREATE TABLE ``;
+
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE ``;
+DROP TABLE `ݏݏ`;
+DROP TABLE `ޏޏ`;
+DROP TABLE `ߏߏ`;
+DROP TABLE ``;
+DROP TABLE ``;
diff --git a/mysql-test/suite/jp/t/jp_create_tbl_utf8.test b/mysql-test/suite/jp/t/jp_create_tbl_utf8.test
new file mode 100644
index 00000000..d079560a
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_create_tbl_utf8.test
@@ -0,0 +1,242 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+DROP TABLE IF EXISTS `アアア`;
+DROP TABLE IF EXISTS `イイイ`;
+DROP TABLE IF EXISTS `ウウウ`;
+DROP TABLE IF EXISTS `エエエ`;
+DROP TABLE IF EXISTS `オオオ`;
+DROP TABLE IF EXISTS `あああ`;
+DROP TABLE IF EXISTS `いいい`;
+DROP TABLE IF EXISTS `ううう`;
+DROP TABLE IF EXISTS `えええ`;
+DROP TABLE IF EXISTS `おおお`;
+DROP TABLE IF EXISTS `龖龖龖`;
+DROP TABLE IF EXISTS `龗龗龗`;
+DROP TABLE IF EXISTS `龞龞龞`;
+DROP TABLE IF EXISTS `龡龡龡`;
+DROP TABLE IF EXISTS `龢龢龢`;
+--enable_warnings
+
+#
+# Test creating table with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS `ウウウ`(`ククク` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TABLE IF NOT EXISTS `龞龞龞`(`丅丅丅`char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `エエエ`(`ケケケ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `オオオ`(`コココ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `えええ`(`けけけ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `おおお`(`こここ` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `龡龡龡`(`丌丌丌` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+CREATE TEMPORARY TABLE `龢龢龢`(`丒丒丒` char(1)) DEFAULT CHARSET = utf8 engine=INNODB;
+
+DESC `アアア`;
+DESC `イイイ`;
+DESC `ウウウ`;
+DESC `エエエ`;
+DESC `オオオ`;
+DESC `あああ`;
+DESC `いいい`;
+DESC `ううう`;
+DESC `えええ`;
+DESC `おおお`;
+DESC `龖龖龖`;
+DESC `龗龗龗`;
+DESC `龞龞龞`;
+DESC `龡龡龡`;
+DESC `龢龢龢`;
+
+SHOW CREATE TABLE `アアア`;
+SHOW CREATE TABLE `イイイ`;
+SHOW CREATE TABLE `ウウウ`;
+SHOW CREATE TABLE `エエエ`;
+SHOW CREATE TABLE `オオオ`;
+SHOW CREATE TABLE `あああ`;
+SHOW CREATE TABLE `いいい`;
+SHOW CREATE TABLE `ううう`;
+SHOW CREATE TABLE `えええ`;
+SHOW CREATE TABLE `おおお`;
+SHOW CREATE TABLE `龖龖龖`;
+SHOW CREATE TABLE `龗龗龗`;
+SHOW CREATE TABLE `龞龞龞`;
+SHOW CREATE TABLE `龡龡龡`;
+SHOW CREATE TABLE `龢龢龢`;
+
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `ウウウ`;
+DROP TABLE `エエエ`;
+DROP TABLE `オオオ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `ううう`;
+DROP TABLE `えええ`;
+DROP TABLE `おおお`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+DROP TABLE `龞龞龞`;
+DROP TABLE `龡龡龡`;
+DROP TABLE `龢龢龢`;
+
+CREATE TABLE `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS `ウウウ`(`ククク` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TABLE IF NOT EXISTS `龞龞龞`(`丅丅丅`char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `エエエ`(`ケケケ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `オオオ`(`コココ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `えええ`(`けけけ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `おおお`(`こここ` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `龡龡龡`(`丌丌丌` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+CREATE TEMPORARY TABLE `龢龢龢`(`丒丒丒` char(1)) DEFAULT CHARSET = utf8 engine=MyISAM;
+
+DESC `アアア`;
+DESC `イイイ`;
+DESC `ウウウ`;
+DESC `エエエ`;
+DESC `オオオ`;
+DESC `あああ`;
+DESC `いいい`;
+DESC `ううう`;
+DESC `えええ`;
+DESC `おおお`;
+DESC `龖龖龖`;
+DESC `龗龗龗`;
+DESC `龞龞龞`;
+DESC `龡龡龡`;
+DESC `龢龢龢`;
+
+SHOW CREATE TABLE `アアア`;
+SHOW CREATE TABLE `イイイ`;
+SHOW CREATE TABLE `ウウウ`;
+SHOW CREATE TABLE `エエエ`;
+SHOW CREATE TABLE `オオオ`;
+SHOW CREATE TABLE `あああ`;
+SHOW CREATE TABLE `いいい`;
+SHOW CREATE TABLE `ううう`;
+SHOW CREATE TABLE `えええ`;
+SHOW CREATE TABLE `おおお`;
+SHOW CREATE TABLE `龖龖龖`;
+SHOW CREATE TABLE `龗龗龗`;
+SHOW CREATE TABLE `龞龞龞`;
+SHOW CREATE TABLE `龡龡龡`;
+SHOW CREATE TABLE `龢龢龢`;
+
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `ウウウ`;
+DROP TABLE `エエエ`;
+DROP TABLE `オオオ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `ううう`;
+DROP TABLE `えええ`;
+DROP TABLE `おおお`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+DROP TABLE `龞龞龞`;
+DROP TABLE `龡龡龡`;
+DROP TABLE `龢龢龢`;
+
+CREATE TABLE `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+# Tables should not be created because table names exist
+CREATE TABLE IF NOT EXISTS `アアア`(`カカカ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `イイイ`(`キキキ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `あああ`(`かかか` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `いいい`(`ききき` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `龖龖龖`(`丂丂丂` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `龗龗龗`(`丄丄丄` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+# Tables should be created
+CREATE TABLE IF NOT EXISTS `ウウウ`(`ククク` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `ううう`(`くくく` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TABLE IF NOT EXISTS `龞龞龞`(`丅丅丅`char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `エエエ`(`ケケケ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `オオオ`(`コココ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `えええ`(`けけけ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `おおお`(`こここ` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `龡龡龡`(`丌丌丌` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+CREATE TEMPORARY TABLE `龢龢龢`(`丒丒丒` char(1)) DEFAULT CHARSET = utf8 engine=MEMORY;
+
+DESC `アアア`;
+DESC `イイイ`;
+DESC `ウウウ`;
+DESC `エエエ`;
+DESC `オオオ`;
+DESC `あああ`;
+DESC `いいい`;
+DESC `ううう`;
+DESC `えええ`;
+DESC `おおお`;
+DESC `龖龖龖`;
+DESC `龗龗龗`;
+DESC `龞龞龞`;
+DESC `龡龡龡`;
+DESC `龢龢龢`;
+
+SHOW CREATE TABLE `アアア`;
+SHOW CREATE TABLE `イイイ`;
+SHOW CREATE TABLE `ウウウ`;
+SHOW CREATE TABLE `エエエ`;
+SHOW CREATE TABLE `オオオ`;
+SHOW CREATE TABLE `あああ`;
+SHOW CREATE TABLE `いいい`;
+SHOW CREATE TABLE `ううう`;
+SHOW CREATE TABLE `えええ`;
+SHOW CREATE TABLE `おおお`;
+SHOW CREATE TABLE `龖龖龖`;
+SHOW CREATE TABLE `龗龗龗`;
+SHOW CREATE TABLE `龞龞龞`;
+SHOW CREATE TABLE `龡龡龡`;
+SHOW CREATE TABLE `龢龢龢`;
+
+DROP TABLE `アアア`;
+DROP TABLE `イイイ`;
+DROP TABLE `ウウウ`;
+DROP TABLE `エエエ`;
+DROP TABLE `オオオ`;
+DROP TABLE `あああ`;
+DROP TABLE `いいい`;
+DROP TABLE `ううう`;
+DROP TABLE `えええ`;
+DROP TABLE `おおお`;
+DROP TABLE `龖龖龖`;
+DROP TABLE `龗龗龗`;
+DROP TABLE `龞龞龞`;
+DROP TABLE `龡龡龡`;
+DROP TABLE `龢龢龢`;
diff --git a/mysql-test/suite/jp/t/jp_enum_sjis.test b/mysql-test/suite/jp/t/jp_enum_sjis.test
new file mode 100644
index 00000000..1060f83e
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_enum_sjis.test
@@ -0,0 +1,130 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+drop table if exists t1;
+--enable_warnings
+
+#
+# Test ENUM values with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` ENUM('\','\','\'), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` ENUM('\','\','\'), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` ENUM('','',''), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` ENUM('\','\','\'), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),('');
+INSERT INTO `sR` VALUES ('\'),('\'),('\');
+INSERT INTO `sS` VALUES (''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),('');
+INSERT INTO `sU` VALUES ('\'),('\'),('\');
+INSERT INTO `sV` VALUES (''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),('');
+INSERT INTO `sX` VALUES ('\'),('\'),('\');
+
+SELECT * FROM `sP`;
+SELECT * FROM `sQ`;
+SELECT * FROM `sR`;
+SELECT * FROM `sS`;
+SELECT * FROM `sT`;
+SELECT * FROM `sU`;
+SELECT * FROM `sV`;
+SELECT * FROM `sW`;
+SELECT * FROM `sX`;
+
+SHOW CREATE TABLE `sP`;
+SHOW CREATE TABLE `sQ`;
+SHOW CREATE TABLE `sR`;
+SHOW CREATE TABLE `sS`;
+SHOW CREATE TABLE `sT`;
+SHOW CREATE TABLE `sU`;
+SHOW CREATE TABLE `sV`;
+SHOW CREATE TABLE `sW`;
+SHOW CREATE TABLE `sX`;
+
+DESC `sP`;
+DESC `sQ`;
+DESC `sR`;
+DESC `sS`;
+DESC `sT`;
+DESC `sU`;
+DESC `sV`;
+DESC `sW`;
+DESC `sX`;
+
+#
+# Test problem with enum values after the colum with NOT NULL restriction
+#
+
+ALTER TABLE `sP` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sQ` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sR` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sS` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sT` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sU` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sV` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sW` ADD `bQ` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `sX` ADD `bQ` CHAR(1) NOT NULL FIRST;
+
+SHOW CREATE TABLE `sP`;
+SHOW CREATE TABLE `sQ`;
+SHOW CREATE TABLE `sR`;
+SHOW CREATE TABLE `sS`;
+SHOW CREATE TABLE `sT`;
+SHOW CREATE TABLE `sU`;
+SHOW CREATE TABLE `sV`;
+SHOW CREATE TABLE `sW`;
+SHOW CREATE TABLE `sX`;
+
+#
+# Test to distinguish 0x9353 and 0x9373
+# Bug#6206 ENUMs are not case sensitive even if declared BINARY
+#
+
+CREATE TABLE t1(c1 enum('S','s')) default character set = sjis;
+INSERT INTO t1 VALUES('S'),('s');
+SELECT * FROM t1 WHERE c1 LIKE 'S';
+DROP TABLE t1;
+
+DESC `sP`;
+DESC `sQ`;
+DESC `sR`;
+DESC `sS`;
+DESC `sT`;
+DESC `sU`;
+DESC `sV`;
+DESC `sW`;
+DESC `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_enum_ucs2.test b/mysql-test/suite/jp/t/jp_enum_ucs2.test
new file mode 100644
index 00000000..321f8952
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_enum_ucs2.test
@@ -0,0 +1,123 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+# half-with kana is not handled correctly in 4.1
+# because of bug #5174
+# It will be fixed in 5.0
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test ENUM values with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+
+#
+# Test problem with enum values after the colum with NOT NULL restriction
+# Bug#7302 UCS2 data in ENUM field get truncated when new column is added
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_enum_ujis.test b/mysql-test/suite/jp/t/jp_enum_ujis.test
new file mode 100644
index 00000000..10e8ad55
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_enum_ujis.test
@@ -0,0 +1,119 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test ENUM values with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` ENUM('','',''), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),('');
+
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+
+#
+# Test problem with enum values after the colum with NOT NULL restriction
+#
+
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `ԣ` ADD `ã` CHAR(1) NOT NULL FIRST;
+
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+SHOW CREATE TABLE `ԣ`;
+
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+DESC `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_enum_utf8.test b/mysql-test/suite/jp/t/jp_enum_utf8.test
new file mode 100644
index 00000000..f67939bd
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_enum_utf8.test
@@ -0,0 +1,118 @@
+#Server variable option 'lower_case_table_names' sets '0' as default value
+#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
+#insensitive filsystem is not allowed.
+-- source include/have_case_sensitive_file_system.inc
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test ENUM values with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` ENUM('ア','イ','ウ'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` ENUM('あ','い','う'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` ENUM('龔','龖','龗'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` ENUM('ア','イ','ウ'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` ENUM('あ','い','う'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` ENUM('龔','龖','龗'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` ENUM('ア','イ','ウ'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` ENUM('あ','い','う'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` ENUM('龔','龖','龗'), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('ア'),('イ'),('ウ');
+INSERT INTO `T2` VALUES ('あ'),('い'),('う');
+INSERT INTO `T3` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T4` VALUES ('ア'),('イ'),('ウ');
+INSERT INTO `T5` VALUES ('あ'),('い'),('う');
+INSERT INTO `T6` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T7` VALUES ('ア'),('イ'),('ウ');
+INSERT INTO `T8` VALUES ('あ'),('い'),('う');
+INSERT INTO `T9` VALUES ('龔'),('龖'),('龗');
+
+SELECT * FROM `T1`;
+SELECT * FROM `T2`;
+SELECT * FROM `T3`;
+SELECT * FROM `T4`;
+SELECT * FROM `T5`;
+SELECT * FROM `T6`;
+SELECT * FROM `T7`;
+SELECT * FROM `T8`;
+SELECT * FROM `T9`;
+
+SHOW CREATE TABLE `T1`;
+SHOW CREATE TABLE `T2`;
+SHOW CREATE TABLE `T3`;
+SHOW CREATE TABLE `T4`;
+SHOW CREATE TABLE `T5`;
+SHOW CREATE TABLE `T6`;
+SHOW CREATE TABLE `T7`;
+SHOW CREATE TABLE `T8`;
+SHOW CREATE TABLE `T9`;
+
+DESC `T1`;
+DESC `T2`;
+DESC `T3`;
+DESC `T4`;
+DESC `T5`;
+DESC `T6`;
+DESC `T7`;
+DESC `T8`;
+DESC `T9`;
+
+#
+# Test problem with enum values after the colum with NOT NULL restriction
+#
+
+ALTER TABLE `T1` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T2` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T3` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T4` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T5` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T6` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T7` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T8` ADD `C2` CHAR(1) NOT NULL FIRST;
+ALTER TABLE `T9` ADD `C2` CHAR(1) NOT NULL FIRST;
+
+SHOW CREATE TABLE `T1`;
+SHOW CREATE TABLE `T2`;
+SHOW CREATE TABLE `T3`;
+SHOW CREATE TABLE `T4`;
+SHOW CREATE TABLE `T5`;
+SHOW CREATE TABLE `T6`;
+SHOW CREATE TABLE `T7`;
+SHOW CREATE TABLE `T8`;
+SHOW CREATE TABLE `T9`;
+
+DESC `T1`;
+DESC `T2`;
+DESC `T3`;
+DESC `T4`;
+DESC `T5`;
+DESC `T6`;
+DESC `T7`;
+DESC `T8`;
+DESC `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_insert_sjis.test b/mysql-test/suite/jp/t/jp_insert_sjis.test
new file mode 100644
index 00000000..957798cb
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_insert_sjis.test
@@ -0,0 +1,282 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test INSERT() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+
+#InnoDB
+SELECT INSERT(`bP`,1,1,'') FROM `sP`;
+SELECT INSERT(`bP`,1,2,'') FROM `sP`;
+SELECT INSERT(`bP`,1,3,'') FROM `sP`;
+SELECT INSERT(`bP`,1,4,'') FROM `sP`;
+SELECT INSERT(`bP`,1,5,'') FROM `sP`;
+SELECT INSERT(`bP`,2,1,'') FROM `sP`;
+SELECT INSERT(`bP`,2,2,'') FROM `sP`;
+SELECT INSERT(`bP`,2,3,'') FROM `sP`;
+SELECT INSERT(`bP`,2,4,'') FROM `sP`;
+SELECT INSERT(`bP`,3,1,'') FROM `sP`;
+SELECT INSERT(`bP`,3,2,'') FROM `sP`;
+SELECT INSERT(`bP`,3,3,'') FROM `sP`;
+SELECT INSERT(`bP`,4,1,'') FROM `sP`;
+SELECT INSERT(`bP`,4,2,'') FROM `sP`;
+SELECT INSERT(`bP`,5,1,'') FROM `sP`;
+SELECT INSERT(`bP`,1,1,' ') FROM `sP`;
+SELECT INSERT(`bP`,1,2,' ') FROM `sP`;
+SELECT INSERT(`bP`,1,3,' ') FROM `sP`;
+SELECT INSERT(`bP`,1,4,' ') FROM `sP`;
+SELECT INSERT(`bP`,1,5,' ') FROM `sP`;
+SELECT INSERT(`bP`,2,1,' ') FROM `sP`;
+SELECT INSERT(`bP`,2,2,' ') FROM `sP`;
+SELECT INSERT(`bP`,2,3,' ') FROM `sP`;
+SELECT INSERT(`bP`,2,4,' ') FROM `sP`;
+SELECT INSERT(`bP`,3,1,' ') FROM `sP`;
+SELECT INSERT(`bP`,3,2,' ') FROM `sP`;
+SELECT INSERT(`bP`,3,3,' ') FROM `sP`;
+SELECT INSERT(`bP`,4,1,' ') FROM `sP`;
+SELECT INSERT(`bP`,4,2,' ') FROM `sP`;
+SELECT INSERT(`bP`,5,1,' ') FROM `sP`;
+SELECT INSERT(`bP`,1,1,'') FROM `sQ`;
+SELECT INSERT(`bP`,1,2,'') FROM `sQ`;
+SELECT INSERT(`bP`,1,3,'') FROM `sQ`;
+SELECT INSERT(`bP`,1,4,'') FROM `sQ`;
+SELECT INSERT(`bP`,1,5,'') FROM `sQ`;
+SELECT INSERT(`bP`,2,1,'') FROM `sQ`;
+SELECT INSERT(`bP`,2,2,'') FROM `sQ`;
+SELECT INSERT(`bP`,2,3,'') FROM `sQ`;
+SELECT INSERT(`bP`,2,4,'') FROM `sQ`;
+SELECT INSERT(`bP`,3,1,'') FROM `sQ`;
+SELECT INSERT(`bP`,3,2,'') FROM `sQ`;
+SELECT INSERT(`bP`,3,3,'') FROM `sQ`;
+SELECT INSERT(`bP`,4,1,'') FROM `sQ`;
+SELECT INSERT(`bP`,4,2,'') FROM `sQ`;
+SELECT INSERT(`bP`,5,1,'') FROM `sQ`;
+SELECT INSERT(`bP`,1,1,'@') FROM `sQ`;
+SELECT INSERT(`bP`,1,2,'@@') FROM `sQ`;
+SELECT INSERT(`bP`,1,3,'@@@') FROM `sQ`;
+SELECT INSERT(`bP`,1,4,'@@@@') FROM `sQ`;
+SELECT INSERT(`bP`,1,5,'@@@@@') FROM `sQ`;
+SELECT INSERT(`bP`,2,1,'@') FROM `sQ`;
+SELECT INSERT(`bP`,2,2,'@@') FROM `sQ`;
+SELECT INSERT(`bP`,2,3,'@@@') FROM `sQ`;
+SELECT INSERT(`bP`,2,4,'@@@@') FROM `sQ`;
+SELECT INSERT(`bP`,3,1,'@') FROM `sQ`;
+SELECT INSERT(`bP`,3,2,'@@') FROM `sQ`;
+SELECT INSERT(`bP`,3,3,'@@@') FROM `sQ`;
+SELECT INSERT(`bP`,4,1,'@') FROM `sQ`;
+SELECT INSERT(`bP`,4,2,'@@') FROM `sQ`;
+SELECT INSERT(`bP`,5,1,'@') FROM `sQ`;
+SELECT INSERT(`bP`,1,1,'\') FROM `sR`;
+SELECT INSERT(`bP`,1,2,'\\' ) FROM `sR`;
+SELECT INSERT(`bP`,1,3,'\\\' ) FROM `sR`;
+SELECT INSERT(`bP`,1,4,'\\\\' ) FROM `sR`;
+SELECT INSERT(`bP`,1,5,'\\\\\' ) FROM `sR`;
+SELECT INSERT(`bP`,2,1,'\') FROM `sR`;
+SELECT INSERT(`bP`,2,2,'\\' ) FROM `sR`;
+SELECT INSERT(`bP`,2,3,'\\\' ) FROM `sR`;
+SELECT INSERT(`bP`,2,4,'\\\\' ) FROM `sR`;
+SELECT INSERT(`bP`,3,1,'\') FROM `sR`;
+SELECT INSERT(`bP`,3,2,'\\' ) FROM `sR`;
+SELECT INSERT(`bP`,3,3,'\\\' ) FROM `sR`;
+SELECT INSERT(`bP`,4,1,'\') FROM `sR`;
+SELECT INSERT(`bP`,4,2,'\\' ) FROM `sR`;
+SELECT INSERT(`bP`,5,1,'\') FROM `sR`;
+
+#MyISAM
+SELECT INSERT(`bP`,1,1,'') FROM `sS`;
+SELECT INSERT(`bP`,1,2,'') FROM `sS`;
+SELECT INSERT(`bP`,1,3,'') FROM `sS`;
+SELECT INSERT(`bP`,1,4,'') FROM `sS`;
+SELECT INSERT(`bP`,1,5,'') FROM `sS`;
+SELECT INSERT(`bP`,2,1,'') FROM `sS`;
+SELECT INSERT(`bP`,2,2,'') FROM `sS`;
+SELECT INSERT(`bP`,2,3,'') FROM `sS`;
+SELECT INSERT(`bP`,2,4,'') FROM `sS`;
+SELECT INSERT(`bP`,3,1,'') FROM `sS`;
+SELECT INSERT(`bP`,3,2,'') FROM `sS`;
+SELECT INSERT(`bP`,3,3,'') FROM `sS`;
+SELECT INSERT(`bP`,4,1,'') FROM `sS`;
+SELECT INSERT(`bP`,4,2,'') FROM `sS`;
+SELECT INSERT(`bP`,5,1,'') FROM `sS`;
+SELECT INSERT(`bP`,1,1,' ') FROM `sS`;
+SELECT INSERT(`bP`,1,2,' ') FROM `sS`;
+SELECT INSERT(`bP`,1,3,' ') FROM `sS`;
+SELECT INSERT(`bP`,1,4,' ') FROM `sS`;
+SELECT INSERT(`bP`,1,5,' ') FROM `sS`;
+SELECT INSERT(`bP`,2,1,' ') FROM `sS`;
+SELECT INSERT(`bP`,2,2,' ') FROM `sS`;
+SELECT INSERT(`bP`,2,3,' ') FROM `sS`;
+SELECT INSERT(`bP`,2,4,' ') FROM `sS`;
+SELECT INSERT(`bP`,3,1,' ') FROM `sS`;
+SELECT INSERT(`bP`,3,2,' ') FROM `sS`;
+SELECT INSERT(`bP`,3,3,' ') FROM `sS`;
+SELECT INSERT(`bP`,4,1,' ') FROM `sS`;
+SELECT INSERT(`bP`,4,2,' ') FROM `sS`;
+SELECT INSERT(`bP`,5,1,' ') FROM `sS`;
+SELECT INSERT(`bP`,1,1,'') FROM `sT`;
+SELECT INSERT(`bP`,1,2,'') FROM `sT`;
+SELECT INSERT(`bP`,1,3,'') FROM `sT`;
+SELECT INSERT(`bP`,1,4,'') FROM `sT`;
+SELECT INSERT(`bP`,1,5,'') FROM `sT`;
+SELECT INSERT(`bP`,2,1,'') FROM `sT`;
+SELECT INSERT(`bP`,2,2,'') FROM `sT`;
+SELECT INSERT(`bP`,2,3,'') FROM `sT`;
+SELECT INSERT(`bP`,2,4,'') FROM `sT`;
+SELECT INSERT(`bP`,3,1,'') FROM `sT`;
+SELECT INSERT(`bP`,3,2,'') FROM `sT`;
+SELECT INSERT(`bP`,3,3,'') FROM `sT`;
+SELECT INSERT(`bP`,4,1,'') FROM `sT`;
+SELECT INSERT(`bP`,4,2,'') FROM `sT`;
+SELECT INSERT(`bP`,5,1,'') FROM `sT`;
+SELECT INSERT(`bP`,1,1,'@') FROM `sT`;
+SELECT INSERT(`bP`,1,2,'@@') FROM `sT`;
+SELECT INSERT(`bP`,1,3,'@@@') FROM `sT`;
+SELECT INSERT(`bP`,1,4,'@@@@') FROM `sT`;
+SELECT INSERT(`bP`,1,5,'@@@@@') FROM `sT`;
+SELECT INSERT(`bP`,2,1,'@') FROM `sT`;
+SELECT INSERT(`bP`,2,2,'@@') FROM `sT`;
+SELECT INSERT(`bP`,2,3,'@@@') FROM `sT`;
+SELECT INSERT(`bP`,2,4,'@@@@') FROM `sT`;
+SELECT INSERT(`bP`,3,1,'@') FROM `sT`;
+SELECT INSERT(`bP`,3,2,'@@') FROM `sT`;
+SELECT INSERT(`bP`,3,3,'@@@') FROM `sT`;
+SELECT INSERT(`bP`,4,1,'@') FROM `sT`;
+SELECT INSERT(`bP`,4,2,'@@') FROM `sT`;
+SELECT INSERT(`bP`,5,1,'@') FROM `sT`;
+SELECT INSERT(`bP`,1,1,'\') FROM `sU`;
+SELECT INSERT(`bP`,1,2,'\\' ) FROM `sU`;
+SELECT INSERT(`bP`,1,3,'\\\' ) FROM `sU`;
+SELECT INSERT(`bP`,1,4,'\\\\' ) FROM `sU`;
+SELECT INSERT(`bP`,1,5,'\\\\\' ) FROM `sU`;
+SELECT INSERT(`bP`,2,1,'\') FROM `sU`;
+SELECT INSERT(`bP`,2,2,'\\') FROM `sU`;
+SELECT INSERT(`bP`,2,3,'\\\' ) FROM `sU`;
+SELECT INSERT(`bP`,2,4,'\\\\' ) FROM `sU`;
+SELECT INSERT(`bP`,3,1,'\') FROM `sU`;
+SELECT INSERT(`bP`,3,2,'\\' ) FROM `sU`;
+SELECT INSERT(`bP`,3,3,'\\\' ) FROM `sU`;
+SELECT INSERT(`bP`,4,1,'\') FROM `sU`;
+SELECT INSERT(`bP`,4,2,'\\' ) FROM `sU`;
+SELECT INSERT(`bP`,5,1,'\') FROM `sU`;
+
+#MEMORY
+SELECT INSERT(`bP`,1,1,'') FROM `sV`;
+SELECT INSERT(`bP`,1,2,'') FROM `sV`;
+SELECT INSERT(`bP`,1,3,'') FROM `sV`;
+SELECT INSERT(`bP`,1,4,'') FROM `sV`;
+SELECT INSERT(`bP`,1,5,'') FROM `sV`;
+SELECT INSERT(`bP`,2,1,'') FROM `sV`;
+SELECT INSERT(`bP`,2,2,'') FROM `sV`;
+SELECT INSERT(`bP`,2,3,'') FROM `sV`;
+SELECT INSERT(`bP`,2,4,'') FROM `sV`;
+SELECT INSERT(`bP`,3,1,'') FROM `sV`;
+SELECT INSERT(`bP`,3,2,'') FROM `sV`;
+SELECT INSERT(`bP`,3,3,'') FROM `sV`;
+SELECT INSERT(`bP`,4,1,'') FROM `sV`;
+SELECT INSERT(`bP`,4,2,'') FROM `sV`;
+SELECT INSERT(`bP`,5,1,'') FROM `sV`;
+SELECT INSERT(`bP`,1,1,' ') FROM `sV`;
+SELECT INSERT(`bP`,1,2,' ') FROM `sV`;
+SELECT INSERT(`bP`,1,3,' ') FROM `sV`;
+SELECT INSERT(`bP`,1,4,' ') FROM `sV`;
+SELECT INSERT(`bP`,1,5,' ') FROM `sV`;
+SELECT INSERT(`bP`,2,1,' ') FROM `sV`;
+SELECT INSERT(`bP`,2,2,' ') FROM `sV`;
+SELECT INSERT(`bP`,2,3,' ') FROM `sV`;
+SELECT INSERT(`bP`,2,4,' ') FROM `sV`;
+SELECT INSERT(`bP`,3,1,' ') FROM `sV`;
+SELECT INSERT(`bP`,3,2,' ') FROM `sV`;
+SELECT INSERT(`bP`,3,3,' ') FROM `sV`;
+SELECT INSERT(`bP`,4,1,' ') FROM `sV`;
+SELECT INSERT(`bP`,4,2,' ') FROM `sV`;
+SELECT INSERT(`bP`,5,1,' ') FROM `sV`;
+SELECT INSERT(`bP`,1,1,'') FROM `sW`;
+SELECT INSERT(`bP`,1,2,'') FROM `sW`;
+SELECT INSERT(`bP`,1,3,'') FROM `sW`;
+SELECT INSERT(`bP`,1,4,'') FROM `sW`;
+SELECT INSERT(`bP`,1,5,'') FROM `sW`;
+SELECT INSERT(`bP`,2,1,'') FROM `sW`;
+SELECT INSERT(`bP`,2,2,'') FROM `sW`;
+SELECT INSERT(`bP`,2,3,'') FROM `sW`;
+SELECT INSERT(`bP`,2,4,'') FROM `sW`;
+SELECT INSERT(`bP`,3,1,'') FROM `sW`;
+SELECT INSERT(`bP`,3,2,'') FROM `sW`;
+SELECT INSERT(`bP`,3,3,'') FROM `sW`;
+SELECT INSERT(`bP`,4,1,'') FROM `sW`;
+SELECT INSERT(`bP`,4,2,'') FROM `sW`;
+SELECT INSERT(`bP`,5,1,'') FROM `sW`;
+SELECT INSERT(`bP`,1,1,'@') FROM `sW`;
+SELECT INSERT(`bP`,1,2,'@@') FROM `sW`;
+SELECT INSERT(`bP`,1,3,'@@@') FROM `sW`;
+SELECT INSERT(`bP`,1,4,'@@@@') FROM `sW`;
+SELECT INSERT(`bP`,1,5,'@@@@@') FROM `sW`;
+SELECT INSERT(`bP`,2,1,'@') FROM `sW`;
+SELECT INSERT(`bP`,2,2,'@@') FROM `sW`;
+SELECT INSERT(`bP`,2,3,'@@@') FROM `sW`;
+SELECT INSERT(`bP`,2,4,'@@@@') FROM `sW`;
+SELECT INSERT(`bP`,3,1,'@') FROM `sW`;
+SELECT INSERT(`bP`,3,2,'@@') FROM `sW`;
+SELECT INSERT(`bP`,3,3,'@@@') FROM `sW`;
+SELECT INSERT(`bP`,4,1,'@') FROM `sW`;
+SELECT INSERT(`bP`,4,2,'@@') FROM `sW`;
+SELECT INSERT(`bP`,5,1,'@') FROM `sW`;
+SELECT INSERT(`bP`,1,1,'\') FROM `sX`;
+SELECT INSERT(`bP`,1,2,'\\' ) FROM `sX`;
+SELECT INSERT(`bP`,1,3,'\\\' ) FROM `sX`;
+SELECT INSERT(`bP`,1,4,'\\\\' ) FROM `sX`;
+SELECT INSERT(`bP`,1,5,'\\\\\' ) FROM `sX`;
+SELECT INSERT(`bP`,2,1,'\') FROM `sX`;
+SELECT INSERT(`bP`,2,2,'\\' ) FROM `sX`;
+SELECT INSERT(`bP`,2,3,'\\\' ) FROM `sX`;
+SELECT INSERT(`bP`,2,4,'\\\\' ) FROM `sX`;
+SELECT INSERT(`bP`,3,1,'\') FROM `sX`;
+SELECT INSERT(`bP`,3,2,'\\' ) FROM `sX`;
+SELECT INSERT(`bP`,3,3,'\\\' ) FROM `sX`;
+SELECT INSERT(`bP`,4,1,'\') FROM `sX`;
+SELECT INSERT(`bP`,4,2,'\\' ) FROM `sX`;
+SELECT INSERT(`bP`,5,1,'\') FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_insert_ucs2.test b/mysql-test/suite/jp/t/jp_insert_ucs2.test
new file mode 100644
index 00000000..0cf29ed3
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_insert_ucs2.test
@@ -0,0 +1,283 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test INSERT() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+
+#MyISAM
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+
+#MEMORY
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_insert_ujis.test b/mysql-test/suite/jp/t/jp_insert_ujis.test
new file mode 100644
index 00000000..ba046df7
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_insert_ujis.test
@@ -0,0 +1,283 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test INSERT() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+SET collation_connection = ujis_japanese_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+
+#MyISAM
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+
+#MEMORY
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,' ') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'') FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,1,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,1,5,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,2,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,2,4,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,3,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,3,3,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,4,1,'') FROM `ԣ`;
+SELECT INSERT(`ã`,4,2,'' ) FROM `ԣ`;
+SELECT INSERT(`ã`,5,1,'') FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_insert_utf8.test b/mysql-test/suite/jp/t/jp_insert_utf8.test
new file mode 100644
index 00000000..464f3bca
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_insert_utf8.test
@@ -0,0 +1,281 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test INSERT() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+
+#InnoDB
+SELECT INSERT(`C1`,1,1,'カ') FROM `T1`;
+SELECT INSERT(`C1`,1,2,'カカ') FROM `T1`;
+SELECT INSERT(`C1`,1,3,'カカカ') FROM `T1`;
+SELECT INSERT(`C1`,1,4,'カカカカ') FROM `T1`;
+SELECT INSERT(`C1`,1,5,'カカカカカ') FROM `T1`;
+SELECT INSERT(`C1`,2,1,'カ') FROM `T1`;
+SELECT INSERT(`C1`,2,2,'カカ') FROM `T1`;
+SELECT INSERT(`C1`,2,3,'カカカ') FROM `T1`;
+SELECT INSERT(`C1`,2,4,'カカカカ') FROM `T1`;
+SELECT INSERT(`C1`,3,1,'カ') FROM `T1`;
+SELECT INSERT(`C1`,3,2,'カカ') FROM `T1`;
+SELECT INSERT(`C1`,3,3,'カカカ') FROM `T1`;
+SELECT INSERT(`C1`,4,1,'カ') FROM `T1`;
+SELECT INSERT(`C1`,4,2,'カカ') FROM `T1`;
+SELECT INSERT(`C1`,5,1,'カ') FROM `T1`;
+SELECT INSERT(`C1`,1,1,' ') FROM `T1`;
+SELECT INSERT(`C1`,1,2,' ') FROM `T1`;
+SELECT INSERT(`C1`,1,3,' ') FROM `T1`;
+SELECT INSERT(`C1`,1,4,' ') FROM `T1`;
+SELECT INSERT(`C1`,1,5,' ') FROM `T1`;
+SELECT INSERT(`C1`,2,1,' ') FROM `T1`;
+SELECT INSERT(`C1`,2,2,' ') FROM `T1`;
+SELECT INSERT(`C1`,2,3,' ') FROM `T1`;
+SELECT INSERT(`C1`,2,4,' ') FROM `T1`;
+SELECT INSERT(`C1`,3,1,' ') FROM `T1`;
+SELECT INSERT(`C1`,3,2,' ') FROM `T1`;
+SELECT INSERT(`C1`,3,3,' ') FROM `T1`;
+SELECT INSERT(`C1`,4,1,' ') FROM `T1`;
+SELECT INSERT(`C1`,4,2,' ') FROM `T1`;
+SELECT INSERT(`C1`,5,1,' ') FROM `T1`;
+SELECT INSERT(`C1`,1,1,'か') FROM `T2`;
+SELECT INSERT(`C1`,1,2,'かか') FROM `T2`;
+SELECT INSERT(`C1`,1,3,'かかか') FROM `T2`;
+SELECT INSERT(`C1`,1,4,'かかかか') FROM `T2`;
+SELECT INSERT(`C1`,1,5,'かかかかか') FROM `T2`;
+SELECT INSERT(`C1`,2,1,'か') FROM `T2`;
+SELECT INSERT(`C1`,2,2,'かか') FROM `T2`;
+SELECT INSERT(`C1`,2,3,'かかか') FROM `T2`;
+SELECT INSERT(`C1`,2,4,'かかかか') FROM `T2`;
+SELECT INSERT(`C1`,3,1,'か') FROM `T2`;
+SELECT INSERT(`C1`,3,2,'かか') FROM `T2`;
+SELECT INSERT(`C1`,3,3,'かかか') FROM `T2`;
+SELECT INSERT(`C1`,4,1,'か') FROM `T2`;
+SELECT INSERT(`C1`,4,2,'かか') FROM `T2`;
+SELECT INSERT(`C1`,5,1,'か') FROM `T2`;
+SELECT INSERT(`C1`,1,1,' ') FROM `T2`;
+SELECT INSERT(`C1`,1,2,'  ') FROM `T2`;
+SELECT INSERT(`C1`,1,3,'   ') FROM `T2`;
+SELECT INSERT(`C1`,1,4,'    ') FROM `T2`;
+SELECT INSERT(`C1`,1,5,'     ') FROM `T2`;
+SELECT INSERT(`C1`,2,1,' ') FROM `T2`;
+SELECT INSERT(`C1`,2,2,'  ') FROM `T2`;
+SELECT INSERT(`C1`,2,3,'   ') FROM `T2`;
+SELECT INSERT(`C1`,2,4,'    ') FROM `T2`;
+SELECT INSERT(`C1`,3,1,' ') FROM `T2`;
+SELECT INSERT(`C1`,3,2,'  ') FROM `T2`;
+SELECT INSERT(`C1`,3,3,'   ') FROM `T2`;
+SELECT INSERT(`C1`,4,1,' ') FROM `T2`;
+SELECT INSERT(`C1`,4,2,'  ') FROM `T2`;
+SELECT INSERT(`C1`,5,1,' ') FROM `T2`;
+SELECT INSERT(`C1`,1,1,'丂') FROM `T3`;
+SELECT INSERT(`C1`,1,2,'丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,1,3,'丂丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,1,4,'丂丂丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,1,5,'丂丂丂丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,2,1,'丂') FROM `T3`;
+SELECT INSERT(`C1`,2,2,'丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,2,3,'丂丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,2,4,'丂丂丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,3,1,'丂') FROM `T3`;
+SELECT INSERT(`C1`,3,2,'丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,3,3,'丂丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,4,1,'丂') FROM `T3`;
+SELECT INSERT(`C1`,4,2,'丂丂' ) FROM `T3`;
+SELECT INSERT(`C1`,5,1,'丂') FROM `T3`;
+
+#MyISAM
+SELECT INSERT(`C1`,1,1,'カ') FROM `T4`;
+SELECT INSERT(`C1`,1,2,'カカ') FROM `T4`;
+SELECT INSERT(`C1`,1,3,'カカカ') FROM `T4`;
+SELECT INSERT(`C1`,1,4,'カカカカ') FROM `T4`;
+SELECT INSERT(`C1`,1,5,'カカカカカ') FROM `T4`;
+SELECT INSERT(`C1`,2,1,'カ') FROM `T4`;
+SELECT INSERT(`C1`,2,2,'カカ') FROM `T4`;
+SELECT INSERT(`C1`,2,3,'カカカ') FROM `T4`;
+SELECT INSERT(`C1`,2,4,'カカカカ') FROM `T4`;
+SELECT INSERT(`C1`,3,1,'カ') FROM `T4`;
+SELECT INSERT(`C1`,3,2,'カカ') FROM `T4`;
+SELECT INSERT(`C1`,3,3,'カカカ') FROM `T4`;
+SELECT INSERT(`C1`,4,1,'カ') FROM `T4`;
+SELECT INSERT(`C1`,4,2,'カカ') FROM `T4`;
+SELECT INSERT(`C1`,5,1,'カ') FROM `T4`;
+SELECT INSERT(`C1`,1,1,' ') FROM `T4`;
+SELECT INSERT(`C1`,1,2,' ') FROM `T4`;
+SELECT INSERT(`C1`,1,3,' ') FROM `T4`;
+SELECT INSERT(`C1`,1,4,' ') FROM `T4`;
+SELECT INSERT(`C1`,1,5,' ') FROM `T4`;
+SELECT INSERT(`C1`,2,1,' ') FROM `T4`;
+SELECT INSERT(`C1`,2,2,' ') FROM `T4`;
+SELECT INSERT(`C1`,2,3,' ') FROM `T4`;
+SELECT INSERT(`C1`,2,4,' ') FROM `T4`;
+SELECT INSERT(`C1`,3,1,' ') FROM `T4`;
+SELECT INSERT(`C1`,3,2,' ') FROM `T4`;
+SELECT INSERT(`C1`,3,3,' ') FROM `T4`;
+SELECT INSERT(`C1`,4,1,' ') FROM `T4`;
+SELECT INSERT(`C1`,4,2,' ') FROM `T4`;
+SELECT INSERT(`C1`,5,1,' ') FROM `T4`;
+SELECT INSERT(`C1`,1,1,'か') FROM `T5`;
+SELECT INSERT(`C1`,1,2,'かか') FROM `T5`;
+SELECT INSERT(`C1`,1,3,'かかか') FROM `T5`;
+SELECT INSERT(`C1`,1,4,'かかかか') FROM `T5`;
+SELECT INSERT(`C1`,1,5,'かかかかか') FROM `T5`;
+SELECT INSERT(`C1`,2,1,'か') FROM `T5`;
+SELECT INSERT(`C1`,2,2,'かか') FROM `T5`;
+SELECT INSERT(`C1`,2,3,'かかか') FROM `T5`;
+SELECT INSERT(`C1`,2,4,'かかかか') FROM `T5`;
+SELECT INSERT(`C1`,3,1,'か') FROM `T5`;
+SELECT INSERT(`C1`,3,2,'かか') FROM `T5`;
+SELECT INSERT(`C1`,3,3,'かかか') FROM `T5`;
+SELECT INSERT(`C1`,4,1,'か') FROM `T5`;
+SELECT INSERT(`C1`,4,2,'かか') FROM `T5`;
+SELECT INSERT(`C1`,5,1,'か') FROM `T5`;
+SELECT INSERT(`C1`,1,1,' ') FROM `T5`;
+SELECT INSERT(`C1`,1,2,'  ') FROM `T5`;
+SELECT INSERT(`C1`,1,3,'   ') FROM `T5`;
+SELECT INSERT(`C1`,1,4,'    ') FROM `T5`;
+SELECT INSERT(`C1`,1,5,'     ') FROM `T5`;
+SELECT INSERT(`C1`,2,1,' ') FROM `T5`;
+SELECT INSERT(`C1`,2,2,'  ') FROM `T5`;
+SELECT INSERT(`C1`,2,3,'   ') FROM `T5`;
+SELECT INSERT(`C1`,2,4,'    ') FROM `T5`;
+SELECT INSERT(`C1`,3,1,' ') FROM `T5`;
+SELECT INSERT(`C1`,3,2,'  ') FROM `T5`;
+SELECT INSERT(`C1`,3,3,'   ') FROM `T5`;
+SELECT INSERT(`C1`,4,1,' ') FROM `T5`;
+SELECT INSERT(`C1`,4,2,'  ') FROM `T5`;
+SELECT INSERT(`C1`,5,1,' ') FROM `T5`;
+SELECT INSERT(`C1`,1,1,'丂') FROM `T6`;
+SELECT INSERT(`C1`,1,2,'丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,1,3,'丂丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,1,4,'丂丂丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,1,5,'丂丂丂丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,2,1,'丂') FROM `T6`;
+SELECT INSERT(`C1`,2,2,'丂丂') FROM `T6`;
+SELECT INSERT(`C1`,2,3,'丂丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,2,4,'丂丂丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,3,1,'丂') FROM `T6`;
+SELECT INSERT(`C1`,3,2,'丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,3,3,'丂丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,4,1,'丂') FROM `T6`;
+SELECT INSERT(`C1`,4,2,'丂丂' ) FROM `T6`;
+SELECT INSERT(`C1`,5,1,'丂') FROM `T6`;
+
+#MEMORY
+SELECT INSERT(`C1`,1,1,'カ') FROM `T7`;
+SELECT INSERT(`C1`,1,2,'カカ') FROM `T7`;
+SELECT INSERT(`C1`,1,3,'カカカ') FROM `T7`;
+SELECT INSERT(`C1`,1,4,'カカカカ') FROM `T7`;
+SELECT INSERT(`C1`,1,5,'カカカカカ') FROM `T7`;
+SELECT INSERT(`C1`,2,1,'カ') FROM `T7`;
+SELECT INSERT(`C1`,2,2,'カカ') FROM `T7`;
+SELECT INSERT(`C1`,2,3,'カカカ') FROM `T7`;
+SELECT INSERT(`C1`,2,4,'カカカカ') FROM `T7`;
+SELECT INSERT(`C1`,3,1,'カ') FROM `T7`;
+SELECT INSERT(`C1`,3,2,'カカ') FROM `T7`;
+SELECT INSERT(`C1`,3,3,'カカカ') FROM `T7`;
+SELECT INSERT(`C1`,4,1,'カ') FROM `T7`;
+SELECT INSERT(`C1`,4,2,'カカ') FROM `T7`;
+SELECT INSERT(`C1`,5,1,'カ') FROM `T7`;
+SELECT INSERT(`C1`,1,1,' ') FROM `T7`;
+SELECT INSERT(`C1`,1,2,' ') FROM `T7`;
+SELECT INSERT(`C1`,1,3,' ') FROM `T7`;
+SELECT INSERT(`C1`,1,4,' ') FROM `T7`;
+SELECT INSERT(`C1`,1,5,' ') FROM `T7`;
+SELECT INSERT(`C1`,2,1,' ') FROM `T7`;
+SELECT INSERT(`C1`,2,2,' ') FROM `T7`;
+SELECT INSERT(`C1`,2,3,' ') FROM `T7`;
+SELECT INSERT(`C1`,2,4,' ') FROM `T7`;
+SELECT INSERT(`C1`,3,1,' ') FROM `T7`;
+SELECT INSERT(`C1`,3,2,' ') FROM `T7`;
+SELECT INSERT(`C1`,3,3,' ') FROM `T7`;
+SELECT INSERT(`C1`,4,1,' ') FROM `T7`;
+SELECT INSERT(`C1`,4,2,' ') FROM `T7`;
+SELECT INSERT(`C1`,5,1,' ') FROM `T7`;
+SELECT INSERT(`C1`,1,1,'か') FROM `T8`;
+SELECT INSERT(`C1`,1,2,'かか') FROM `T8`;
+SELECT INSERT(`C1`,1,3,'かかか') FROM `T8`;
+SELECT INSERT(`C1`,1,4,'かかかか') FROM `T8`;
+SELECT INSERT(`C1`,1,5,'かかかかか') FROM `T8`;
+SELECT INSERT(`C1`,2,1,'か') FROM `T8`;
+SELECT INSERT(`C1`,2,2,'かか') FROM `T8`;
+SELECT INSERT(`C1`,2,3,'かかか') FROM `T8`;
+SELECT INSERT(`C1`,2,4,'かかかか') FROM `T8`;
+SELECT INSERT(`C1`,3,1,'か') FROM `T8`;
+SELECT INSERT(`C1`,3,2,'かか') FROM `T8`;
+SELECT INSERT(`C1`,3,3,'かかか') FROM `T8`;
+SELECT INSERT(`C1`,4,1,'か') FROM `T8`;
+SELECT INSERT(`C1`,4,2,'かか') FROM `T8`;
+SELECT INSERT(`C1`,5,1,'か') FROM `T8`;
+SELECT INSERT(`C1`,1,1,' ') FROM `T8`;
+SELECT INSERT(`C1`,1,2,'  ') FROM `T8`;
+SELECT INSERT(`C1`,1,3,'   ') FROM `T8`;
+SELECT INSERT(`C1`,1,4,'    ') FROM `T8`;
+SELECT INSERT(`C1`,1,5,'     ') FROM `T8`;
+SELECT INSERT(`C1`,2,1,' ') FROM `T8`;
+SELECT INSERT(`C1`,2,2,'  ') FROM `T8`;
+SELECT INSERT(`C1`,2,3,'   ') FROM `T8`;
+SELECT INSERT(`C1`,2,4,'    ') FROM `T8`;
+SELECT INSERT(`C1`,3,1,' ') FROM `T8`;
+SELECT INSERT(`C1`,3,2,'  ') FROM `T8`;
+SELECT INSERT(`C1`,3,3,'   ') FROM `T8`;
+SELECT INSERT(`C1`,4,1,' ') FROM `T8`;
+SELECT INSERT(`C1`,4,2,'  ') FROM `T8`;
+SELECT INSERT(`C1`,5,1,' ') FROM `T8`;
+SELECT INSERT(`C1`,1,1,'丂') FROM `T9`;
+SELECT INSERT(`C1`,1,2,'丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,1,3,'丂丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,1,4,'丂丂丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,1,5,'丂丂丂丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,2,1,'丂') FROM `T9`;
+SELECT INSERT(`C1`,2,2,'丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,2,3,'丂丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,2,4,'丂丂丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,3,1,'丂') FROM `T9`;
+SELECT INSERT(`C1`,3,2,'丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,3,3,'丂丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,4,1,'丂') FROM `T9`;
+SELECT INSERT(`C1`,4,2,'丂丂' ) FROM `T9`;
+SELECT INSERT(`C1`,5,1,'丂') FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_instr_sjis.test b/mysql-test/suite/jp/t/jp_instr_sjis.test
new file mode 100644
index 00000000..626429f2
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_instr_sjis.test
@@ -0,0 +1,111 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test INSTR() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+
+#InnoDB
+SELECT INSTR(`bP`,'') from `sP`;
+SELECT INSTR(`bP`,'') from `sP`;
+SELECT INSTR(`bP`,'') from `sP`;
+SELECT INSTR(`bP`,'') from `sP`;
+SELECT INSTR(`bP`,'') from `sP`;
+SELECT INSTR(`bP`,'') from `sP`;
+SELECT INSTR(`bP`,'') from `sQ`;
+SELECT INSTR(`bP`,'') from `sQ`;
+SELECT INSTR(`bP`,'') from `sQ`;
+SELECT INSTR(`bP`,'') from `sQ`;
+SELECT INSTR(`bP`,'') from `sQ`;
+SELECT INSTR(`bP`,'') from `sQ`;
+SELECT INSTR(`bP`,'\') from `sR`;
+SELECT INSTR(`bP`,'\') from `sR`;
+SELECT INSTR(`bP`,'\') from `sR`;
+SELECT INSTR(`bP`,'\') from `sR`;
+SELECT INSTR(`bP`,'\') from `sR`;
+SELECT INSTR(`bP`,'\') from `sR`;
+
+#MyISAM
+SELECT INSTR(`bP`,'') from `sS`;
+SELECT INSTR(`bP`,'') from `sS`;
+SELECT INSTR(`bP`,'') from `sS`;
+SELECT INSTR(`bP`,'') from `sS`;
+SELECT INSTR(`bP`,'') from `sS`;
+SELECT INSTR(`bP`,'') from `sS`;
+SELECT INSTR(`bP`,'') from `sT`;
+SELECT INSTR(`bP`,'') from `sT`;
+SELECT INSTR(`bP`,'') from `sT`;
+SELECT INSTR(`bP`,'') from `sT`;
+SELECT INSTR(`bP`,'') from `sT`;
+SELECT INSTR(`bP`,'') from `sT`;
+SELECT INSTR(`bP`,'\') from `sU`;
+SELECT INSTR(`bP`,'\') from `sU`;
+SELECT INSTR(`bP`,'\') from `sU`;
+SELECT INSTR(`bP`,'\') from `sU`;
+SELECT INSTR(`bP`,'\') from `sU`;
+SELECT INSTR(`bP`,'\') from `sU`;
+
+#MEMORY
+SELECT INSTR(`bP`,'') from `sV`;
+SELECT INSTR(`bP`,'') from `sV`;
+SELECT INSTR(`bP`,'') from `sV`;
+SELECT INSTR(`bP`,'') from `sV`;
+SELECT INSTR(`bP`,'') from `sV`;
+SELECT INSTR(`bP`,'') from `sV`;
+SELECT INSTR(`bP`,'') from `sW`;
+SELECT INSTR(`bP`,'') from `sW`;
+SELECT INSTR(`bP`,'') from `sW`;
+SELECT INSTR(`bP`,'') from `sW`;
+SELECT INSTR(`bP`,'') from `sW`;
+SELECT INSTR(`bP`,'') from `sW`;
+SELECT INSTR(`bP`,'\') from `sX`;
+SELECT INSTR(`bP`,'\') from `sX`;
+SELECT INSTR(`bP`,'\') from `sX`;
+SELECT INSTR(`bP`,'\') from `sX`;
+SELECT INSTR(`bP`,'\') from `sX`;
+SELECT INSTR(`bP`,'\') from `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_instr_ucs2.test b/mysql-test/suite/jp/t/jp_instr_ucs2.test
new file mode 100644
index 00000000..a074e315
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_instr_ucs2.test
@@ -0,0 +1,112 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test INSTR() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+
+#MyISAM
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+
+#MEMORY
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_instr_ujis.test b/mysql-test/suite/jp/t/jp_instr_ujis.test
new file mode 100644
index 00000000..b2dd2335
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_instr_ujis.test
@@ -0,0 +1,111 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test INSTR() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+
+#MyISAM
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+
+#MEMORY
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+SELECT INSTR(`ã`,'') from `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_instr_utf8.test b/mysql-test/suite/jp/t/jp_instr_utf8.test
new file mode 100644
index 00000000..27c2cb24
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_instr_utf8.test
@@ -0,0 +1,110 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test INSTR() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+
+#InnoDB
+SELECT INSTR(`C1`,'ア') from `T1`;
+SELECT INSTR(`C1`,'イ') from `T1`;
+SELECT INSTR(`C1`,'ウ') from `T1`;
+SELECT INSTR(`C1`,'エ') from `T1`;
+SELECT INSTR(`C1`,'オ') from `T1`;
+SELECT INSTR(`C1`,'ン') from `T1`;
+SELECT INSTR(`C1`,'あ') from `T2`;
+SELECT INSTR(`C1`,'い') from `T2`;
+SELECT INSTR(`C1`,'う') from `T2`;
+SELECT INSTR(`C1`,'え') from `T2`;
+SELECT INSTR(`C1`,'お') from `T2`;
+SELECT INSTR(`C1`,'ん') from `T2`;
+SELECT INSTR(`C1`,'龔') from `T3`;
+SELECT INSTR(`C1`,'龖') from `T3`;
+SELECT INSTR(`C1`,'龗') from `T3`;
+SELECT INSTR(`C1`,'龞') from `T3`;
+SELECT INSTR(`C1`,'龡') from `T3`;
+SELECT INSTR(`C1`,'丂') from `T3`;
+
+#MyISAM
+SELECT INSTR(`C1`,'ア') from `T4`;
+SELECT INSTR(`C1`,'イ') from `T4`;
+SELECT INSTR(`C1`,'ウ') from `T4`;
+SELECT INSTR(`C1`,'エ') from `T4`;
+SELECT INSTR(`C1`,'オ') from `T4`;
+SELECT INSTR(`C1`,'ン') from `T4`;
+SELECT INSTR(`C1`,'あ') from `T5`;
+SELECT INSTR(`C1`,'い') from `T5`;
+SELECT INSTR(`C1`,'う') from `T5`;
+SELECT INSTR(`C1`,'え') from `T5`;
+SELECT INSTR(`C1`,'お') from `T5`;
+SELECT INSTR(`C1`,'ん') from `T5`;
+SELECT INSTR(`C1`,'龔') from `T6`;
+SELECT INSTR(`C1`,'龖') from `T6`;
+SELECT INSTR(`C1`,'龗') from `T6`;
+SELECT INSTR(`C1`,'龞') from `T6`;
+SELECT INSTR(`C1`,'龡') from `T6`;
+SELECT INSTR(`C1`,'丂') from `T6`;
+
+#MEMORY
+SELECT INSTR(`C1`,'ア') from `T7`;
+SELECT INSTR(`C1`,'イ') from `T7`;
+SELECT INSTR(`C1`,'ウ') from `T7`;
+SELECT INSTR(`C1`,'エ') from `T7`;
+SELECT INSTR(`C1`,'オ') from `T7`;
+SELECT INSTR(`C1`,'ン') from `T7`;
+SELECT INSTR(`C1`,'あ') from `T8`;
+SELECT INSTR(`C1`,'い') from `T8`;
+SELECT INSTR(`C1`,'う') from `T8`;
+SELECT INSTR(`C1`,'え') from `T8`;
+SELECT INSTR(`C1`,'お') from `T8`;
+SELECT INSTR(`C1`,'ん') from `T8`;
+SELECT INSTR(`C1`,'龔') from `T9`;
+SELECT INSTR(`C1`,'龖') from `T9`;
+SELECT INSTR(`C1`,'龗') from `T9`;
+SELECT INSTR(`C1`,'龞') from `T9`;
+SELECT INSTR(`C1`,'龡') from `T9`;
+SELECT INSTR(`C1`,'丂') from `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_join_sjis.test b/mysql-test/suite/jp/t/jp_join_sjis.test
new file mode 100644
index 00000000..031b6bc8
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_join_sjis.test
@@ -0,0 +1,179 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+DROP TABLE IF EXISTS `sPa`;
+DROP TABLE IF EXISTS `sPb`;
+DROP TABLE IF EXISTS `sQa`;
+DROP TABLE IF EXISTS `sQb`;
+DROP TABLE IF EXISTS `sRa`;
+DROP TABLE IF EXISTS `sRb`;
+DROP TABLE IF EXISTS `sSa`;
+DROP TABLE IF EXISTS `sSb`;
+DROP TABLE IF EXISTS `sTa`;
+DROP TABLE IF EXISTS `sTb`;
+DROP TABLE IF EXISTS `sUa`;
+DROP TABLE IF EXISTS `sUb`;
+DROP TABLE IF EXISTS `sVa`;
+DROP TABLE IF EXISTS `sVb`;
+DROP TABLE IF EXISTS `sWa`;
+DROP TABLE IF EXISTS `sWb`;
+DROP TABLE IF EXISTS `sXa`;
+DROP TABLE IF EXISTS `sXb`;
+--enable_warnings
+
+#
+# Test table JOIN using Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sPa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sPb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sSa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sSb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sVa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sVb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `sPa` VALUES (''),(''),('');
+INSERT INTO `sPb` VALUES ('');
+INSERT INTO `sQa` VALUES (''),(''),('');
+INSERT INTO `sQb` VALUES ('');
+INSERT INTO `sRa` VALUES ('\'),('\'),('\');
+INSERT INTO `sRb` VALUES ('\');
+INSERT INTO `sSa` VALUES (''),(''),('');
+INSERT INTO `sSb` VALUES ('');
+INSERT INTO `sTa` VALUES (''),(''),('');
+INSERT INTO `sTb` VALUES ('');
+INSERT INTO `sUa` VALUES ('\'),('\'),('\');
+INSERT INTO `sUb` VALUES ('\');
+INSERT INTO `sVa` VALUES (''),(''),('');
+INSERT INTO `sVb` VALUES ('');
+INSERT INTO `sWa` VALUES (''),(''),('');
+INSERT INTO `sWb` VALUES ('');
+INSERT INTO `sXa` VALUES ('\'),('\'),('\');
+INSERT INTO `sXb` VALUES ('\');
+
+#Test for innodb
+SELECT * FROM `sPa` JOIN `sPb`;
+SELECT * FROM `sPa` INNER JOIN `sPb`;
+SELECT * FROM `sPa` JOIN `sPb` USING (`bP`);
+SELECT * FROM `sPa` INNER JOIN `sPb` USING (`bP`);
+SELECT * FROM `sPa` CROSS JOIN `sPb`;
+SELECT * FROM `sPa` LEFT JOIN `sPb` USING (`bP`);
+SELECT * FROM `sPa` LEFT JOIN `sPb` ON (`sPa`.`bP` = `sPb`.`bP`);
+SELECT * FROM `sPb` RIGHT JOIN `sPa` USING (`bP`);
+SELECT * FROM `sPb` RIGHT JOIN `sPa` ON (`sPa`.`bP` = `sPb`.`bP`);
+SELECT * FROM `sQa` JOIN `sQb`;
+SELECT * FROM `sQa` INNER JOIN `sQb`;
+SELECT * FROM `sQa` JOIN `sQb` USING (`bP`);
+SELECT * FROM `sQa` INNER JOIN `sQb` USING (`bP`);
+SELECT * FROM `sQa` CROSS JOIN `sQb`;
+SELECT * FROM `sQa` LEFT JOIN `sQb` USING (`bP`);
+SELECT * FROM `sQa` LEFT JOIN `sQb` ON (`sQa`.`bP` = `sQb`.`bP`);
+SELECT * FROM `sQb` RIGHT JOIN `sQa` USING (`bP`);
+SELECT * FROM `sQb` RIGHT JOIN `sQa` ON (`sQa`.`bP` = `sQb`.`bP`);
+SELECT * FROM `sRa` JOIN `sRb`;
+SELECT * FROM `sRa` INNER JOIN `sRb`;
+SELECT * FROM `sRa` JOIN `sRb` USING (`bP`);
+SELECT * FROM `sRa` INNER JOIN `sRb` USING (`bP`);
+SELECT * FROM `sRa` CROSS JOIN `sRb`;
+SELECT * FROM `sRa` LEFT JOIN `sRb` USING (`bP`);
+SELECT * FROM `sRa` LEFT JOIN `sRb` ON (`sRa`.`bP` = `sRb`.`bP`);
+SELECT * FROM `sRb` RIGHT JOIN `sRa` USING (`bP`);
+SELECT * FROM `sRb` RIGHT JOIN `sRa` ON (`sRa`.`bP` = `sRb`.`bP`);
+
+#Test for myisam
+SELECT * FROM `sSa` JOIN `sSb`;
+SELECT * FROM `sSa` INNER JOIN `sSb`;
+SELECT * FROM `sSa` JOIN `sSb` USING (`bP`);
+SELECT * FROM `sSa` INNER JOIN `sSb` USING (`bP`);
+SELECT * FROM `sSa` CROSS JOIN `sSb`;
+SELECT * FROM `sSa` LEFT JOIN `sSb` USING (`bP`);
+SELECT * FROM `sSa` LEFT JOIN `sSb` ON (`sSa`.`bP` = `sSb`.`bP`);
+SELECT * FROM `sSb` RIGHT JOIN `sSa` USING (`bP`);
+SELECT * FROM `sSb` RIGHT JOIN `sSa` ON (`sSa`.`bP` = `sSb`.`bP`);
+SELECT * FROM `sTa` JOIN `sTb`;
+SELECT * FROM `sTa` INNER JOIN `sTb`;
+SELECT * FROM `sTa` JOIN `sTb` USING (`bP`);
+SELECT * FROM `sTa` INNER JOIN `sTb` USING (`bP`);
+SELECT * FROM `sTa` CROSS JOIN `sTb`;
+SELECT * FROM `sTa` LEFT JOIN `sTb` USING (`bP`);
+SELECT * FROM `sTa` LEFT JOIN `sTb` ON (`sTa`.`bP` = `sTb`.`bP`);
+SELECT * FROM `sTb` RIGHT JOIN `sTa` USING (`bP`);
+SELECT * FROM `sTb` RIGHT JOIN `sTa` ON (`sTa`.`bP` = `sTb`.`bP`);
+SELECT * FROM `sUa` JOIN `sUb`;
+SELECT * FROM `sUa` INNER JOIN `sUb`;
+SELECT * FROM `sUa` JOIN `sUb` USING (`bP`);
+SELECT * FROM `sUa` INNER JOIN `sUb` USING (`bP`);
+SELECT * FROM `sUa` CROSS JOIN `sUb`;
+SELECT * FROM `sUa` LEFT JOIN `sUb` USING (`bP`);
+SELECT * FROM `sUa` LEFT JOIN `sUb` ON (`sUa`.`bP` = `sUb`.`bP`);
+SELECT * FROM `sUb` RIGHT JOIN `sUa` USING (`bP`);
+SELECT * FROM `sUb` RIGHT JOIN `sUa` ON (`sUa`.`bP` = `sUb`.`bP`);
+
+#Test for MEMORY
+SELECT * FROM `sVa` JOIN `sVb`;
+SELECT * FROM `sVa` INNER JOIN `sVb`;
+SELECT * FROM `sVa` JOIN `sVb` USING (`bP`);
+SELECT * FROM `sVa` INNER JOIN `sVb` USING (`bP`);
+SELECT * FROM `sVa` CROSS JOIN `sVb`;
+SELECT * FROM `sVa` LEFT JOIN `sVb` USING (`bP`);
+SELECT * FROM `sVa` LEFT JOIN `sVb` ON (`sVa`.`bP` = `sVb`.`bP`);
+SELECT * FROM `sVb` RIGHT JOIN `sVa` USING (`bP`);
+SELECT * FROM `sVb` RIGHT JOIN `sVa` ON (`sVa`.`bP` = `sVb`.`bP`);
+SELECT * FROM `sWa` JOIN `sWb`;
+SELECT * FROM `sWa` INNER JOIN `sWb`;
+SELECT * FROM `sWa` JOIN `sWb` USING (`bP`);
+SELECT * FROM `sWa` INNER JOIN `sWb` USING (`bP`);
+SELECT * FROM `sWa` CROSS JOIN `sWb`;
+SELECT * FROM `sWa` LEFT JOIN `sWb` USING (`bP`);
+SELECT * FROM `sWa` LEFT JOIN `sWb` ON (`sWa`.`bP` = `sWb`.`bP`);
+SELECT * FROM `sWb` RIGHT JOIN `sWa` USING (`bP`);
+SELECT * FROM `sWb` RIGHT JOIN `sWa` ON (`sWa`.`bP` = `sWb`.`bP`);
+SELECT * FROM `sXa` JOIN `sXb`;
+SELECT * FROM `sXa` INNER JOIN `sXb`;
+SELECT * FROM `sXa` JOIN `sXb` USING (`bP`);
+SELECT * FROM `sXa` INNER JOIN `sXb` USING (`bP`);
+SELECT * FROM `sXa` CROSS JOIN `sXb`;
+SELECT * FROM `sXa` LEFT JOIN `sXb` USING (`bP`);
+SELECT * FROM `sXa` LEFT JOIN `sXb` ON (`sXa`.`bP` = `sXb`.`bP`);
+SELECT * FROM `sXb` RIGHT JOIN `sXa` USING (`bP`);
+SELECT * FROM `sXb` RIGHT JOIN `sXa` ON (`sXa`.`bP` = `sXb`.`bP`);
+
+DROP TABLE `sPa`;
+DROP TABLE `sPb`;
+DROP TABLE `sQa`;
+DROP TABLE `sQb`;
+DROP TABLE `sRa`;
+DROP TABLE `sRb`;
+DROP TABLE `sSa`;
+DROP TABLE `sSb`;
+DROP TABLE `sTa`;
+DROP TABLE `sTb`;
+DROP TABLE `sUa`;
+DROP TABLE `sUb`;
+DROP TABLE `sVa`;
+DROP TABLE `sVb`;
+DROP TABLE `sWa`;
+DROP TABLE `sWb`;
+DROP TABLE `sXa`;
+DROP TABLE `sXb`;
diff --git a/mysql-test/suite/jp/t/jp_join_ucs2.test b/mysql-test/suite/jp/t/jp_join_ucs2.test
new file mode 100644
index 00000000..2c3a9c24
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_join_ucs2.test
@@ -0,0 +1,180 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+--enable_warnings
+
+#
+# Test table JOIN using Japanese characters
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MyISAM;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+
+#Test for innodb
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+
+#Test for myisam
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+
+#Test for MEMORY
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/t/jp_join_ujis.test b/mysql-test/suite/jp/t/jp_join_ujis.test
new file mode 100644
index 00000000..973c4669
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_join_ujis.test
@@ -0,0 +1,179 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+--enable_warnings
+
+#
+# Test table JOIN using Japanese characters
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = memory;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+
+#Test for innodb
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+
+#Test for myisam
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+
+#Test for MEMORY
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣa` JOIN `ԣb`;
+SELECT * FROM `ԣa` INNER JOIN `ԣb`;
+SELECT * FROM `ԣa` JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` INNER JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` CROSS JOIN `ԣb`;
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` USING (`ã`);
+SELECT * FROM `ԣa` LEFT JOIN `ԣb` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` USING (`ã`);
+SELECT * FROM `ԣb` RIGHT JOIN `ԣa` ON (`ԣa`.`ã` = `ԣb`.`ã`);
+
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/t/jp_join_utf8.test b/mysql-test/suite/jp/t/jp_join_utf8.test
new file mode 100644
index 00000000..d4e25691
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_join_utf8.test
@@ -0,0 +1,178 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1a`;
+drop table if exists `T1b`;
+drop table if exists `T2a`;
+drop table if exists `T2b`;
+drop table if exists `T3a`;
+drop table if exists `T3b`;
+drop table if exists `T4a`;
+drop table if exists `T4b`;
+drop table if exists `T5a`;
+drop table if exists `T5b`;
+drop table if exists `T6a`;
+drop table if exists `T6b`;
+drop table if exists `T7a`;
+drop table if exists `T7b`;
+drop table if exists `T8a`;
+drop table if exists `T8b`;
+drop table if exists `T9a`;
+drop table if exists `T9b`;
+--enable_warnings
+
+#
+# Test table JOIN using Japanese characters in utf8
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T1b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T2a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T2b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T3a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T3b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = InnoDB;
+CREATE TABLE `T4a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T4b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T5a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T5b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T6a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T6b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
+CREATE TABLE `T7a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T7b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `T1a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T1b` VALUES ('ア');
+INSERT INTO `T2a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T2b` VALUES ('あ');
+INSERT INTO `T3a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T3b` VALUES ('龔');
+INSERT INTO `T4a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T4b` VALUES ('ア');
+INSERT INTO `T5a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T5b` VALUES ('あ');
+INSERT INTO `T6a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T6b` VALUES ('龔');
+INSERT INTO `T7a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T7b` VALUES ('ア');
+INSERT INTO `T8a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T8b` VALUES ('あ');
+INSERT INTO `T9a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T9b` VALUES ('龔');
+
+#Test for InnoDB
+SELECT * FROM `T1a` JOIN `T1b`;
+SELECT * FROM `T1a` INNER JOIN `T1b`;
+SELECT * FROM `T1a` JOIN `T1b` USING (`C1`);
+SELECT * FROM `T1a` INNER JOIN `T1b` USING (`C1`);
+SELECT * FROM `T1a` CROSS JOIN `T1b`;
+SELECT * FROM `T1a` LEFT JOIN `T1b` USING (`C1`);
+SELECT * FROM `T1a` LEFT JOIN `T1b` ON (`T1a`.`C1` = `T1b`.`C1`);
+SELECT * FROM `T1b` RIGHT JOIN `T1a` USING (`C1`);
+SELECT * FROM `T1b` RIGHT JOIN `T1a` ON (`T1a`.`C1` = `T1b`.`C1`);
+SELECT * FROM `T2a` JOIN `T2b`;
+SELECT * FROM `T2a` INNER JOIN `T2b`;
+SELECT * FROM `T2a` JOIN `T2b` USING (`C1`);
+SELECT * FROM `T2a` INNER JOIN `T2b` USING (`C1`);
+SELECT * FROM `T2a` CROSS JOIN `T2b`;
+SELECT * FROM `T2a` LEFT JOIN `T2b` USING (`C1`);
+SELECT * FROM `T2a` LEFT JOIN `T2b` ON (`T2a`.`C1` = `T2b`.`C1`);
+SELECT * FROM `T2b` RIGHT JOIN `T2a` USING (`C1`);
+SELECT * FROM `T2b` RIGHT JOIN `T2a` ON (`T2a`.`C1` = `T2b`.`C1`);
+SELECT * FROM `T3a` JOIN `T3b`;
+SELECT * FROM `T3a` INNER JOIN `T3b`;
+SELECT * FROM `T3a` JOIN `T3b` USING (`C1`);
+SELECT * FROM `T3a` INNER JOIN `T3b` USING (`C1`);
+SELECT * FROM `T3a` CROSS JOIN `T3b`;
+SELECT * FROM `T3a` LEFT JOIN `T3b` USING (`C1`);
+SELECT * FROM `T3a` LEFT JOIN `T3b` ON (`T3a`.`C1` = `T3b`.`C1`);
+SELECT * FROM `T3b` RIGHT JOIN `T3a` USING (`C1`);
+SELECT * FROM `T3b` RIGHT JOIN `T3a` ON (`T3a`.`C1` = `T3b`.`C1`);
+
+#Test for myisam
+SELECT * FROM `T4a` JOIN `T4b`;
+SELECT * FROM `T4a` INNER JOIN `T4b`;
+SELECT * FROM `T4a` JOIN `T4b` USING (`C1`);
+SELECT * FROM `T4a` INNER JOIN `T4b` USING (`C1`);
+SELECT * FROM `T4a` CROSS JOIN `T4b`;
+SELECT * FROM `T4a` LEFT JOIN `T4b` USING (`C1`);
+SELECT * FROM `T4a` LEFT JOIN `T4b` ON (`T4a`.`C1` = `T4b`.`C1`);
+SELECT * FROM `T4b` RIGHT JOIN `T4a` USING (`C1`);
+SELECT * FROM `T4b` RIGHT JOIN `T4a` ON (`T4a`.`C1` = `T4b`.`C1`);
+SELECT * FROM `T5a` JOIN `T5b`;
+SELECT * FROM `T5a` INNER JOIN `T5b`;
+SELECT * FROM `T5a` JOIN `T5b` USING (`C1`);
+SELECT * FROM `T5a` INNER JOIN `T5b` USING (`C1`);
+SELECT * FROM `T5a` CROSS JOIN `T5b`;
+SELECT * FROM `T5a` LEFT JOIN `T5b` USING (`C1`);
+SELECT * FROM `T5a` LEFT JOIN `T5b` ON (`T5a`.`C1` = `T5b`.`C1`);
+SELECT * FROM `T5b` RIGHT JOIN `T5a` USING (`C1`);
+SELECT * FROM `T5b` RIGHT JOIN `T5a` ON (`T5a`.`C1` = `T5b`.`C1`);
+SELECT * FROM `T6a` JOIN `T6b`;
+SELECT * FROM `T6a` INNER JOIN `T6b`;
+SELECT * FROM `T6a` JOIN `T6b` USING (`C1`);
+SELECT * FROM `T6a` INNER JOIN `T6b` USING (`C1`);
+SELECT * FROM `T6a` CROSS JOIN `T6b`;
+SELECT * FROM `T6a` LEFT JOIN `T6b` USING (`C1`);
+SELECT * FROM `T6a` LEFT JOIN `T6b` ON (`T6a`.`C1` = `T6b`.`C1`);
+SELECT * FROM `T6b` RIGHT JOIN `T6a` USING (`C1`);
+SELECT * FROM `T6b` RIGHT JOIN `T6a` ON (`T6a`.`C1` = `T6b`.`C1`);
+
+#Test for MEMORY
+SELECT * FROM `T7a` JOIN `T7b`;
+SELECT * FROM `T7a` INNER JOIN `T7b`;
+SELECT * FROM `T7a` JOIN `T7b` USING (`C1`);
+SELECT * FROM `T7a` INNER JOIN `T7b` USING (`C1`);
+SELECT * FROM `T7a` CROSS JOIN `T7b`;
+SELECT * FROM `T7a` LEFT JOIN `T7b` USING (`C1`);
+SELECT * FROM `T7a` LEFT JOIN `T7b` ON (`T7a`.`C1` = `T7b`.`C1`);
+SELECT * FROM `T7b` RIGHT JOIN `T7a` USING (`C1`);
+SELECT * FROM `T7b` RIGHT JOIN `T7a` ON (`T7a`.`C1` = `T7b`.`C1`);
+SELECT * FROM `T8a` JOIN `T8b`;
+SELECT * FROM `T8a` INNER JOIN `T8b`;
+SELECT * FROM `T8a` JOIN `T8b` USING (`C1`);
+SELECT * FROM `T8a` INNER JOIN `T8b` USING (`C1`);
+SELECT * FROM `T8a` CROSS JOIN `T8b`;
+SELECT * FROM `T8a` LEFT JOIN `T8b` USING (`C1`);
+SELECT * FROM `T8a` LEFT JOIN `T8b` ON (`T8a`.`C1` = `T8b`.`C1`);
+SELECT * FROM `T8b` RIGHT JOIN `T8a` USING (`C1`);
+SELECT * FROM `T8b` RIGHT JOIN `T8a` ON (`T8a`.`C1` = `T8b`.`C1`);
+SELECT * FROM `T9a` JOIN `T9b`;
+SELECT * FROM `T9a` INNER JOIN `T9b`;
+SELECT * FROM `T9a` JOIN `T9b` USING (`C1`);
+SELECT * FROM `T9a` INNER JOIN `T9b` USING (`C1`);
+SELECT * FROM `T9a` CROSS JOIN `T9b`;
+SELECT * FROM `T9a` LEFT JOIN `T9b` USING (`C1`);
+SELECT * FROM `T9a` LEFT JOIN `T9b` ON (`T9a`.`C1` = `T9b`.`C1`);
+SELECT * FROM `T9b` RIGHT JOIN `T9a` USING (`C1`);
+SELECT * FROM `T9b` RIGHT JOIN `T9a` ON (`T9a`.`C1` = `T9b`.`C1`);
+
+DROP TABLE `T1a`;
+DROP TABLE `T1b`;
+DROP TABLE `T2a`;
+DROP TABLE `T2b`;
+DROP TABLE `T3a`;
+DROP TABLE `T3b`;
+DROP TABLE `T4a`;
+DROP TABLE `T4b`;
+DROP TABLE `T5a`;
+DROP TABLE `T5b`;
+DROP TABLE `T6a`;
+DROP TABLE `T6b`;
+DROP TABLE `T7a`;
+DROP TABLE `T7b`;
+DROP TABLE `T8a`;
+DROP TABLE `T8b`;
+DROP TABLE `T9a`;
+DROP TABLE `T9b`;
diff --git a/mysql-test/suite/jp/t/jp_left_sjis.test b/mysql-test/suite/jp/t/jp_left_sjis.test
new file mode 100644
index 00000000..0d718ccc
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_left_sjis.test
@@ -0,0 +1,111 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test LEFT() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, LEFT(`bP`,0) FROM `sP`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sP`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sP`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sP`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sP`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sP`;
+SELECT `bP`, LEFT(`bP`,0) FROM `sQ`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sQ`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sQ`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sQ`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sQ`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sQ`;
+SELECT `bP`, LEFT(`bP`,0) FROM `sR`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sR`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sR`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sR`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sR`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sR`;
+
+#MyISAM
+SELECT `bP`, LEFT(`bP`,0) FROM `sS`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sS`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sS`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sS`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sS`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sS`;
+SELECT `bP`, LEFT(`bP`,0) FROM `sT`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sT`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sT`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sT`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sT`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sT`;
+SELECT `bP`, LEFT(`bP`,0) FROM `sU`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sU`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sU`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sU`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sU`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, LEFT(`bP`,0) FROM `sV`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sV`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sV`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sV`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sV`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sV`;
+SELECT `bP`, LEFT(`bP`,0) FROM `sW`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sW`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sW`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sW`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sW`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sW`;
+SELECT `bP`, LEFT(`bP`,0) FROM `sX`;
+SELECT `bP`, LEFT(`bP`,1) FROM `sX`;
+SELECT `bP`, LEFT(`bP`,2) FROM `sX`;
+SELECT `bP`, LEFT(`bP`,3) FROM `sX`;
+SELECT `bP`, LEFT(`bP`,4) FROM `sX`;
+SELECT `bP`, LEFT(`bP`,5) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_left_ucs2.test b/mysql-test/suite/jp/t/jp_left_ucs2.test
new file mode 100644
index 00000000..3d55283c
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_left_ucs2.test
@@ -0,0 +1,112 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LEFT() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_left_ujis.test b/mysql-test/suite/jp/t/jp_left_ujis.test
new file mode 100644
index 00000000..04619fa2
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_left_ujis.test
@@ -0,0 +1,111 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LEFT() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, LEFT(`ã`,5) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_left_utf8.test b/mysql-test/suite/jp/t/jp_left_utf8.test
new file mode 100644
index 00000000..0f77c170
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_left_utf8.test
@@ -0,0 +1,110 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test LEFT() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, LEFT(`C1`,0) FROM `T1`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T1`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T1`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T1`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T1`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T1`;
+SELECT `C1`, LEFT(`C1`,0) FROM `T2`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T2`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T2`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T2`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T2`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T2`;
+SELECT `C1`, LEFT(`C1`,0) FROM `T3`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T3`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T3`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T3`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T3`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T3`;
+
+#MyISAM
+SELECT `C1`, LEFT(`C1`,0) FROM `T4`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T4`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T4`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T4`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T4`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T4`;
+SELECT `C1`, LEFT(`C1`,0) FROM `T5`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T5`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T5`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T5`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T5`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T5`;
+SELECT `C1`, LEFT(`C1`,0) FROM `T6`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T6`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T6`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T6`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T6`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, LEFT(`C1`,0) FROM `T7`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T7`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T7`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T7`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T7`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T7`;
+SELECT `C1`, LEFT(`C1`,0) FROM `T8`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T8`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T8`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T8`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T8`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T8`;
+SELECT `C1`, LEFT(`C1`,0) FROM `T9`;
+SELECT `C1`, LEFT(`C1`,1) FROM `T9`;
+SELECT `C1`, LEFT(`C1`,2) FROM `T9`;
+SELECT `C1`, LEFT(`C1`,3) FROM `T9`;
+SELECT `C1`, LEFT(`C1`,4) FROM `T9`;
+SELECT `C1`, LEFT(`C1`,5) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_length_sjis.test b/mysql-test/suite/jp/t/jp_length_sjis.test
new file mode 100644
index 00000000..acc6be97
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_length_sjis.test
@@ -0,0 +1,66 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test LENGTH() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, LENGTH(`bP`) FROM `sP`;
+SELECT `bP`, LENGTH(`bP`) FROM `sQ`;
+SELECT `bP`, LENGTH(`bP`) FROM `sR`;
+
+#MyISAM
+SELECT `bP`, LENGTH(`bP`) FROM `sS`;
+SELECT `bP`, LENGTH(`bP`) FROM `sT`;
+SELECT `bP`, LENGTH(`bP`) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, LENGTH(`bP`) FROM `sV`;
+SELECT `bP`, LENGTH(`bP`) FROM `sW`;
+SELECT `bP`, LENGTH(`bP`) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_length_ucs2.test b/mysql-test/suite/jp/t/jp_length_ucs2.test
new file mode 100644
index 00000000..41fd8171
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_length_ucs2.test
@@ -0,0 +1,67 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LENGTH() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_length_ujis.test b/mysql-test/suite/jp/t/jp_length_ujis.test
new file mode 100644
index 00000000..33a0baa4
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_length_ujis.test
@@ -0,0 +1,66 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LENGTH() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+SELECT `ã`, LENGTH(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_length_utf8.test b/mysql-test/suite/jp/t/jp_length_utf8.test
new file mode 100644
index 00000000..ffb5b4fd
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_length_utf8.test
@@ -0,0 +1,65 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test LENGTH() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, LENGTH(`C1`) FROM `T1`;
+SELECT `C1`, LENGTH(`C1`) FROM `T2`;
+SELECT `C1`, LENGTH(`C1`) FROM `T3`;
+
+#MyISAM
+SELECT `C1`, LENGTH(`C1`) FROM `T4`;
+SELECT `C1`, LENGTH(`C1`) FROM `T5`;
+SELECT `C1`, LENGTH(`C1`) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, LENGTH(`C1`) FROM `T7`;
+SELECT `C1`, LENGTH(`C1`) FROM `T8`;
+SELECT `C1`, LENGTH(`C1`) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_like_sjis.test b/mysql-test/suite/jp/t/jp_like_sjis.test
new file mode 100644
index 00000000..6cb60928
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_like_sjis.test
@@ -0,0 +1,132 @@
+--character_set sjis
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test LIKE pattern matching using Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+
+#InnoDB
+SELECT * FROM `sP` WHERE `bP` LIKE ' %';
+SELECT * FROM `sP` WHERE `bP` LIKE '% %';
+SELECT * FROM `sP` WHERE `bP` LIKE '% ';
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+SELECT * FROM `sP` WHERE `bP` LIKE '%%';
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+SELECT * FROM `sP` WHERE `bP` LIKE '%%';
+SELECT * FROM `sP` WHERE `bP` LIKE '%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '@%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%@%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%@';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%';
+SELECT * FROM `sQ` WHERE `bP` LIKE 'E%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%E%';
+SELECT * FROM `sQ` WHERE `bP` LIKE '%E';
+SELECT * FROM `sR` WHERE `bP` LIKE '\%';
+SELECT * FROM `sR` WHERE `bP` LIKE '%\%';
+SELECT * FROM `sR` WHERE `bP` LIKE '%\';
+SELECT * FROM `sR` WHERE `bP` LIKE '\\\\\\\\\\\\\\\\\\\\%';
+SELECT * FROM `sR` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\%';
+SELECT * FROM `sR` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\';
+
+#MyISAM
+SELECT * FROM `sS` WHERE `bP` LIKE ' %';
+SELECT * FROM `sS` WHERE `bP` LIKE '% %';
+SELECT * FROM `sS` WHERE `bP` LIKE '% ';
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+SELECT * FROM `sS` WHERE `bP` LIKE '%%';
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+SELECT * FROM `sS` WHERE `bP` LIKE '%%';
+SELECT * FROM `sS` WHERE `bP` LIKE '%';
+SELECT * FROM `sT` WHERE `bP` LIKE '@%';
+SELECT * FROM `sT` WHERE `bP` LIKE '%@%';
+SELECT * FROM `sT` WHERE `bP` LIKE '%@';
+SELECT * FROM `sT` WHERE `bP` LIKE '%';
+SELECT * FROM `sT` WHERE `bP` LIKE '%%';
+SELECT * FROM `sT` WHERE `bP` LIKE '%';
+SELECT * FROM `sT` WHERE `bP` LIKE 'E%';
+SELECT * FROM `sT` WHERE `bP` LIKE '%E%';
+SELECT * FROM `sT` WHERE `bP` LIKE '%E';
+SELECT * FROM `sU` WHERE `bP` LIKE '\%';
+SELECT * FROM `sU` WHERE `bP` LIKE '%\%';
+SELECT * FROM `sU` WHERE `bP` LIKE '%\';
+SELECT * FROM `sU` WHERE `bP` LIKE '\\\\\\\\\\\\\\\\\\\\%';
+SELECT * FROM `sU` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\%';
+SELECT * FROM `sU` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\';
+
+#MEMORY
+SELECT * FROM `sV` WHERE `bP` LIKE ' %';
+SELECT * FROM `sV` WHERE `bP` LIKE '% %';
+SELECT * FROM `sV` WHERE `bP` LIKE '% ';
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+SELECT * FROM `sV` WHERE `bP` LIKE '%%';
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+SELECT * FROM `sV` WHERE `bP` LIKE '%%';
+SELECT * FROM `sV` WHERE `bP` LIKE '%';
+SELECT * FROM `sW` WHERE `bP` LIKE '@%';
+SELECT * FROM `sW` WHERE `bP` LIKE '%@%';
+SELECT * FROM `sW` WHERE `bP` LIKE '%@';
+SELECT * FROM `sW` WHERE `bP` LIKE '%';
+SELECT * FROM `sW` WHERE `bP` LIKE '%%';
+SELECT * FROM `sW` WHERE `bP` LIKE '%';
+SELECT * FROM `sW` WHERE `bP` LIKE 'E%';
+SELECT * FROM `sW` WHERE `bP` LIKE '%E%';
+SELECT * FROM `sW` WHERE `bP` LIKE '%E';
+SELECT * FROM `sX` WHERE `bP` LIKE '\%';
+SELECT * FROM `sX` WHERE `bP` LIKE '%\%';
+SELECT * FROM `sX` WHERE `bP` LIKE '%\';
+SELECT * FROM `sX` WHERE `bP` LIKE '\\\\\\\\\\\\\\\\\\\\%';
+SELECT * FROM `sX` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\%';
+SELECT * FROM `sX` WHERE `bP` LIKE '%\\\\\\\\\\\\\\\\\\\\';
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_like_ucs2.test b/mysql-test/suite/jp/t/jp_like_ucs2.test
new file mode 100644
index 00000000..1fd7d559
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_like_ucs2.test
@@ -0,0 +1,209 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LIKE pattern matching using Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+#Insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('')
+,('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ')
+,('ܤݤޤߤ')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('')
+,('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ')
+,('ܤݤޤߤ')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('')
+,('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('Ȥɤʤˤ̤ͤΤϤФѤҤӤԤդ֤פؤ٤ڤ')
+,('ܤݤޤߤ')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+#INNODB
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+
+#MyISAM
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+
+#MEMORY
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_like_ujis.test b/mysql-test/suite/jp/t/jp_like_ujis.test
new file mode 100644
index 00000000..dccb49d0
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_like_ujis.test
@@ -0,0 +1,134 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LIKE pattern matching using Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+
+#InnoDB
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+
+#MyISAM
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+
+#MEMORY
+SELECT * FROM `ԣ` WHERE `ã` LIKE ' %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% %';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '% ';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%׎%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE 'ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ%';
+SELECT * FROM `ԣ` WHERE `ã` LIKE '%ÏďŏƏ';
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_like_utf8.test b/mysql-test/suite/jp/t/jp_like_utf8.test
new file mode 100644
index 00000000..4332922f
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_like_utf8.test
@@ -0,0 +1,133 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test LIKE pattern matching using Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+
+#InnoDB
+SELECT * FROM `T1` WHERE `C1` LIKE ' %';
+SELECT * FROM `T1` WHERE `C1` LIKE '% %';
+SELECT * FROM `T1` WHERE `C1` LIKE '% ';
+SELECT * FROM `T1` WHERE `C1` LIKE 'タ%';
+SELECT * FROM `T1` WHERE `C1` LIKE '%ラリ%';
+SELECT * FROM `T1` WHERE `C1` LIKE '%ソ';
+SELECT * FROM `T1` WHERE `C1` LIKE 'ーアイウエオカキクケコサシスセソ%';
+SELECT * FROM `T1` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ%';
+SELECT * FROM `T1` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ';
+SELECT * FROM `T2` WHERE `C1` LIKE ' %';
+SELECT * FROM `T2` WHERE `C1` LIKE '% %';
+SELECT * FROM `T2` WHERE `C1` LIKE '% ';
+SELECT * FROM `T2` WHERE `C1` LIKE 'と%';
+SELECT * FROM `T2` WHERE `C1` LIKE '%あ%';
+SELECT * FROM `T2` WHERE `C1` LIKE '%わ';
+SELECT * FROM `T2` WHERE `C1` LIKE '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+SELECT * FROM `T2` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+SELECT * FROM `T2` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+SELECT * FROM `T3` WHERE `C1` LIKE '鼫%';
+SELECT * FROM `T3` WHERE `C1` LIKE '%鼺%';
+SELECT * FROM `T3` WHERE `C1` LIKE '%齖';
+SELECT * FROM `T3` WHERE `C1` LIKE '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+SELECT * FROM `T3` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+SELECT * FROM `T3` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+
+#MyISAM
+SELECT * FROM `T4` WHERE `C1` LIKE ' %';
+SELECT * FROM `T4` WHERE `C1` LIKE '% %';
+SELECT * FROM `T4` WHERE `C1` LIKE '% ';
+SELECT * FROM `T4` WHERE `C1` LIKE 'タ%';
+SELECT * FROM `T4` WHERE `C1` LIKE '%ラリ%';
+SELECT * FROM `T4` WHERE `C1` LIKE '%ソ';
+SELECT * FROM `T4` WHERE `C1` LIKE 'ーアイウエオカキクケコサシスセソ%';
+SELECT * FROM `T4` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ%';
+SELECT * FROM `T4` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ';
+SELECT * FROM `T5` WHERE `C1` LIKE ' %';
+SELECT * FROM `T5` WHERE `C1` LIKE '% %';
+SELECT * FROM `T5` WHERE `C1` LIKE '% ';
+SELECT * FROM `T5` WHERE `C1` LIKE 'と%';
+SELECT * FROM `T5` WHERE `C1` LIKE '%あ%';
+SELECT * FROM `T5` WHERE `C1` LIKE '%わ';
+SELECT * FROM `T5` WHERE `C1` LIKE '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+SELECT * FROM `T5` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+SELECT * FROM `T5` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+SELECT * FROM `T6` WHERE `C1` LIKE '鼫%';
+SELECT * FROM `T6` WHERE `C1` LIKE '%鼺%';
+SELECT * FROM `T6` WHERE `C1` LIKE '%齖';
+SELECT * FROM `T6` WHERE `C1` LIKE '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+SELECT * FROM `T6` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+SELECT * FROM `T6` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+
+#MEMORY
+SELECT * FROM `T7` WHERE `C1` LIKE ' %';
+SELECT * FROM `T7` WHERE `C1` LIKE '% %';
+SELECT * FROM `T7` WHERE `C1` LIKE '% ';
+SELECT * FROM `T7` WHERE `C1` LIKE 'タ%';
+SELECT * FROM `T7` WHERE `C1` LIKE '%ラリ%';
+SELECT * FROM `T7` WHERE `C1` LIKE '%ソ';
+SELECT * FROM `T7` WHERE `C1` LIKE 'ーアイウエオカキクケコサシスセソ%';
+SELECT * FROM `T7` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ%';
+SELECT * FROM `T7` WHERE `C1` LIKE '%ーアイウエオカキクケコサシスセソ';
+SELECT * FROM `T8` WHERE `C1` LIKE ' %';
+SELECT * FROM `T8` WHERE `C1` LIKE '% %';
+SELECT * FROM `T8` WHERE `C1` LIKE '% ';
+SELECT * FROM `T8` WHERE `C1` LIKE 'と%';
+SELECT * FROM `T8` WHERE `C1` LIKE '%あ%';
+SELECT * FROM `T8` WHERE `C1` LIKE '%わ';
+SELECT * FROM `T8` WHERE `C1` LIKE '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+SELECT * FROM `T8` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ%';
+SELECT * FROM `T8` WHERE `C1` LIKE '%・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+SELECT * FROM `T9` WHERE `C1` LIKE '鼫%';
+SELECT * FROM `T9` WHERE `C1` LIKE '%鼺%';
+SELECT * FROM `T9` WHERE `C1` LIKE '%齖';
+SELECT * FROM `T9` WHERE `C1` LIKE '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+SELECT * FROM `T9` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖%';
+SELECT * FROM `T9` WHERE `C1` LIKE '%鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_locate_sjis.test b/mysql-test/suite/jp/t/jp_locate_sjis.test
new file mode 100644
index 00000000..e7a21e0e
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_locate_sjis.test
@@ -0,0 +1,112 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test LOCATE() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+
+#InnoDB
+SELECT LOCATE('',`bP`) from `sP`;
+SELECT LOCATE('',`bP`) from `sP`;
+SELECT LOCATE('',`bP`) from `sP`;
+SELECT LOCATE('',`bP`) from `sP`;
+SELECT LOCATE('',`bP`) from `sP`;
+SELECT LOCATE('',`bP`) from `sP`;
+SELECT LOCATE('',`bP`) from `sQ`;
+SELECT LOCATE('',`bP`) from `sQ`;
+SELECT LOCATE('',`bP`) from `sQ`;
+SELECT LOCATE('',`bP`) from `sQ`;
+SELECT LOCATE('',`bP`) from `sQ`;
+SELECT LOCATE('',`bP`) from `sQ`;
+SELECT LOCATE('\',`bP`) from `sR`;
+SELECT LOCATE('\',`bP`) from `sR`;
+SELECT LOCATE('\',`bP`) from `sR`;
+SELECT LOCATE('\',`bP`) from `sR`;
+SELECT LOCATE('\',`bP`) from `sR`;
+SELECT LOCATE('\',`bP`) from `sR`;
+
+#MyISAM
+SELECT LOCATE('',`bP`) from `sS`;
+SELECT LOCATE('',`bP`) from `sS`;
+SELECT LOCATE('',`bP`) from `sS`;
+SELECT LOCATE('',`bP`) from `sS`;
+SELECT LOCATE('',`bP`) from `sS`;
+SELECT LOCATE('',`bP`) from `sS`;
+SELECT LOCATE('',`bP`) from `sT`;
+SELECT LOCATE('',`bP`) from `sT`;
+SELECT LOCATE('',`bP`) from `sT`;
+SELECT LOCATE('',`bP`) from `sT`;
+SELECT LOCATE('',`bP`) from `sT`;
+SELECT LOCATE('',`bP`) from `sT`;
+SELECT LOCATE('\',`bP`) from `sU`;
+SELECT LOCATE('\',`bP`) from `sU`;
+SELECT LOCATE('\',`bP`) from `sU`;
+SELECT LOCATE('\',`bP`) from `sU`;
+SELECT LOCATE('\',`bP`) from `sU`;
+SELECT LOCATE('\',`bP`) from `sU`;
+
+
+#MEMORY
+SELECT LOCATE('',`bP`) from `sV`;
+SELECT LOCATE('',`bP`) from `sV`;
+SELECT LOCATE('',`bP`) from `sV`;
+SELECT LOCATE('',`bP`) from `sV`;
+SELECT LOCATE('',`bP`) from `sV`;
+SELECT LOCATE('',`bP`) from `sV`;
+SELECT LOCATE('',`bP`) from `sW`;
+SELECT LOCATE('',`bP`) from `sW`;
+SELECT LOCATE('',`bP`) from `sW`;
+SELECT LOCATE('',`bP`) from `sW`;
+SELECT LOCATE('',`bP`) from `sW`;
+SELECT LOCATE('',`bP`) from `sW`;
+SELECT LOCATE('\',`bP`) from `sX`;
+SELECT LOCATE('\',`bP`) from `sX`;
+SELECT LOCATE('\',`bP`) from `sX`;
+SELECT LOCATE('\',`bP`) from `sX`;
+SELECT LOCATE('\',`bP`) from `sX`;
+SELECT LOCATE('\',`bP`) from `sX`;
+
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_locate_ucs2.test b/mysql-test/suite/jp/t/jp_locate_ucs2.test
new file mode 100644
index 00000000..02b95a20
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_locate_ucs2.test
@@ -0,0 +1,114 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LOCATE() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+
+#MyISAM
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+
+
+#MEMORY
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_locate_ujis.test b/mysql-test/suite/jp/t/jp_locate_ujis.test
new file mode 100644
index 00000000..21e3fa1d
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_locate_ujis.test
@@ -0,0 +1,113 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LOCATE() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+
+#MyISAM
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+
+
+#MEMORY
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+SELECT LOCATE('',`ã`) from `ԣ`;
+
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_locate_utf8.test b/mysql-test/suite/jp/t/jp_locate_utf8.test
new file mode 100644
index 00000000..6e965eaf
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_locate_utf8.test
@@ -0,0 +1,112 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test LOCATE() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+
+#InnoDB
+SELECT LOCATE('ア',`C1`) from `T1`;
+SELECT LOCATE('イ',`C1`) from `T1`;
+SELECT LOCATE('ウ',`C1`) from `T1`;
+SELECT LOCATE('エ',`C1`) from `T1`;
+SELECT LOCATE('オ',`C1`) from `T1`;
+SELECT LOCATE('ン',`C1`) from `T1`;
+SELECT LOCATE('あ',`C1`) from `T2`;
+SELECT LOCATE('い',`C1`) from `T2`;
+SELECT LOCATE('う',`C1`) from `T2`;
+SELECT LOCATE('え',`C1`) from `T2`;
+SELECT LOCATE('お',`C1`) from `T2`;
+SELECT LOCATE('ん',`C1`) from `T2`;
+SELECT LOCATE('龔',`C1`) from `T3`;
+SELECT LOCATE('龖',`C1`) from `T3`;
+SELECT LOCATE('龗',`C1`) from `T3`;
+SELECT LOCATE('龞',`C1`) from `T3`;
+SELECT LOCATE('龡',`C1`) from `T3`;
+SELECT LOCATE('丂',`C1`) from `T3`;
+
+#MyISAM
+SELECT LOCATE('ア',`C1`) from `T4`;
+SELECT LOCATE('イ',`C1`) from `T4`;
+SELECT LOCATE('ウ',`C1`) from `T4`;
+SELECT LOCATE('エ',`C1`) from `T4`;
+SELECT LOCATE('オ',`C1`) from `T4`;
+SELECT LOCATE('ン',`C1`) from `T4`;
+SELECT LOCATE('あ',`C1`) from `T5`;
+SELECT LOCATE('い',`C1`) from `T5`;
+SELECT LOCATE('う',`C1`) from `T5`;
+SELECT LOCATE('え',`C1`) from `T5`;
+SELECT LOCATE('お',`C1`) from `T5`;
+SELECT LOCATE('ん',`C1`) from `T5`;
+SELECT LOCATE('龔',`C1`) from `T6`;
+SELECT LOCATE('龖',`C1`) from `T6`;
+SELECT LOCATE('龗',`C1`) from `T6`;
+SELECT LOCATE('龞',`C1`) from `T6`;
+SELECT LOCATE('龡',`C1`) from `T6`;
+SELECT LOCATE('丂',`C1`) from `T6`;
+
+
+#MEMORY
+SELECT LOCATE('ア',`C1`) from `T7`;
+SELECT LOCATE('イ',`C1`) from `T7`;
+SELECT LOCATE('ウ',`C1`) from `T7`;
+SELECT LOCATE('エ',`C1`) from `T7`;
+SELECT LOCATE('オ',`C1`) from `T7`;
+SELECT LOCATE('ン',`C1`) from `T7`;
+SELECT LOCATE('あ',`C1`) from `T8`;
+SELECT LOCATE('い',`C1`) from `T8`;
+SELECT LOCATE('う',`C1`) from `T8`;
+SELECT LOCATE('え',`C1`) from `T8`;
+SELECT LOCATE('お',`C1`) from `T8`;
+SELECT LOCATE('ん',`C1`) from `T8`;
+SELECT LOCATE('龔',`C1`) from `T9`;
+SELECT LOCATE('龖',`C1`) from `T9`;
+SELECT LOCATE('龗',`C1`) from `T9`;
+SELECT LOCATE('龞',`C1`) from `T9`;
+SELECT LOCATE('龡',`C1`) from `T9`;
+SELECT LOCATE('丂',`C1`) from `T9`;
+
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_lpad_sjis.test b/mysql-test/suite/jp/t/jp_lpad_sjis.test
new file mode 100644
index 00000000..1516acc1
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_lpad_sjis.test
@@ -0,0 +1,66 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test LPAD() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, LPAD(`bP`,5,'') FROM `sP`;
+SELECT `bP`, LPAD(`bP`,5,'w') FROM `sQ`;
+SELECT `bP`, LPAD(`bP`,5,'\') FROM `sR`;
+
+#MyISAM
+SELECT `bP`, LPAD(`bP`,5,'') FROM `sS`;
+SELECT `bP`, LPAD(`bP`,5,'w') FROM `sT`;
+SELECT `bP`, LPAD(`bP`,5,'\' ) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, LPAD(`bP`,5,'') FROM `sV`;
+SELECT `bP`, LPAD(`bP`,5,'w') FROM `sW`;
+SELECT `bP`, LPAD(`bP`,5,'\' ) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_lpad_ucs2.test b/mysql-test/suite/jp/t/jp_lpad_ucs2.test
new file mode 100644
index 00000000..3f8e9fd9
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_lpad_ucs2.test
@@ -0,0 +1,67 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LPAD() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_lpad_ujis.test b/mysql-test/suite/jp/t/jp_lpad_ujis.test
new file mode 100644
index 00000000..9d4ef185
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_lpad_ujis.test
@@ -0,0 +1,66 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LPAD() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, LPAD(`ã`,5,'' ) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_lpad_utf8.test b/mysql-test/suite/jp/t/jp_lpad_utf8.test
new file mode 100644
index 00000000..b629751d
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_lpad_utf8.test
@@ -0,0 +1,65 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test LPAD() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, LPAD(`C1`,5,'。') FROM `T1`;
+SELECT `C1`, LPAD(`C1`,5,'X') FROM `T2`;
+SELECT `C1`, LPAD(`C1`,5,'丄') FROM `T3`;
+
+#MyISAM
+SELECT `C1`, LPAD(`C1`,5,'。') FROM `T4`;
+SELECT `C1`, LPAD(`C1`,5,'X') FROM `T5`;
+SELECT `C1`, LPAD(`C1`,5,'丄' ) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, LPAD(`C1`,5,'。') FROM `T7`;
+SELECT `C1`, LPAD(`C1`,5,'X') FROM `T8`;
+SELECT `C1`, LPAD(`C1`,5,'丄' ) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_ltrim_sjis.test b/mysql-test/suite/jp/t/jp_ltrim_sjis.test
new file mode 100644
index 00000000..4a02fcdc
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_ltrim_sjis.test
@@ -0,0 +1,129 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test LTRIM() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sP` VALUES ('@');
+INSERT INTO `sP` VALUES ('@@');
+INSERT INTO `sP` VALUES ('@@@');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sQ` VALUES ('@');
+INSERT INTO `sQ` VALUES ('@@');
+INSERT INTO `sQ` VALUES ('@@@');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES (' \\\\\');
+INSERT INTO `sR` VALUES (' \\\\\');
+INSERT INTO `sR` VALUES (' \\\\\');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sR` VALUES ('@\\\\\');
+INSERT INTO `sR` VALUES ('@@\\\\\');
+INSERT INTO `sR` VALUES ('@@@\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sS` VALUES ('@');
+INSERT INTO `sS` VALUES ('@@');
+INSERT INTO `sS` VALUES ('@@@');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sT` VALUES ('@');
+INSERT INTO `sT` VALUES ('@@');
+INSERT INTO `sT` VALUES ('@@@');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sU` VALUES (' \\\\\');
+INSERT INTO `sU` VALUES (' \\\\\');
+INSERT INTO `sU` VALUES (' \\\\\');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sU` VALUES ('@\\\\\');
+INSERT INTO `sU` VALUES ('@@\\\\\');
+INSERT INTO `sU` VALUES ('@@@\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sV` VALUES ('@');
+INSERT INTO `sV` VALUES ('@@');
+INSERT INTO `sV` VALUES ('@@@');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sW` VALUES ('@');
+INSERT INTO `sW` VALUES ('@@');
+INSERT INTO `sW` VALUES ('@@@');
+INSERT INTO `sX` VALUES ('\\\\\');
+INSERT INTO `sX` VALUES (' \\\\\');
+INSERT INTO `sX` VALUES (' \\\\\');
+INSERT INTO `sX` VALUES (' \\\\\');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sX` VALUES ('@\\\\\');
+INSERT INTO `sX` VALUES ('@@\\\\\');
+INSERT INTO `sX` VALUES ('@@@\\\\\');
+
+#InnoDB
+SELECT LTRIM(`bP`) from `sP`;
+SELECT LTRIM(`bP`) from `sQ`;
+SELECT LTRIM(`bP`) from `sR`;
+
+#MyISAM
+SELECT LTRIM(`bP`) from `sS`;
+SELECT LTRIM(`bP`) from `sT`;
+SELECT LTRIM(`bP`) from `sU`;
+
+#MEMORY
+SELECT LTRIM(`bP`) from `sV`;
+SELECT LTRIM(`bP`) from `sW`;
+SELECT LTRIM(`bP`) from `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_ltrim_ucs2.test b/mysql-test/suite/jp/t/jp_ltrim_ucs2.test
new file mode 100644
index 00000000..65ea8d01
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_ltrim_ucs2.test
@@ -0,0 +1,130 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LTRIM() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+
+#MyISAM
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+
+#MEMORY
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_ltrim_ujis.test b/mysql-test/suite/jp/t/jp_ltrim_ujis.test
new file mode 100644
index 00000000..9c5487a3
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_ltrim_ujis.test
@@ -0,0 +1,129 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test LTRIM() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+
+#MyISAM
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+
+#MEMORY
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+SELECT LTRIM(`ã`) from `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_ltrim_utf8.test b/mysql-test/suite/jp/t/jp_ltrim_utf8.test
new file mode 100644
index 00000000..3fcd5cbd
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_ltrim_utf8.test
@@ -0,0 +1,128 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test LTRIM() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES (' アイウエオ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T1` VALUES (' アイウエオ');
+INSERT INTO `T1` VALUES ('  アイウエオ');
+INSERT INTO `T1` VALUES ('   アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES (' あいうえお');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T2` VALUES (' あいうえお');
+INSERT INTO `T2` VALUES ('  あいうえお');
+INSERT INTO `T2` VALUES ('   あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('  龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('   龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES (' アイウエオ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T4` VALUES (' アイウエオ');
+INSERT INTO `T4` VALUES ('  アイウエオ');
+INSERT INTO `T4` VALUES ('   アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES (' あいうえお');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T5` VALUES (' あいうえお');
+INSERT INTO `T5` VALUES ('  あいうえお');
+INSERT INTO `T5` VALUES ('   あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('  龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('   龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES (' アイウエオ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T7` VALUES (' アイウエオ');
+INSERT INTO `T7` VALUES ('  アイウエオ');
+INSERT INTO `T7` VALUES ('   アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES (' あいうえお');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T8` VALUES (' あいうえお');
+INSERT INTO `T8` VALUES ('  あいうえお');
+INSERT INTO `T8` VALUES ('   あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('  龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('   龔龖龗龞龡');
+
+#InnoDB
+SELECT LTRIM(`C1`) from `T1`;
+SELECT LTRIM(`C1`) from `T2`;
+SELECT LTRIM(`C1`) from `T3`;
+
+#MyISAM
+SELECT LTRIM(`C1`) from `T4`;
+SELECT LTRIM(`C1`) from `T5`;
+SELECT LTRIM(`C1`) from `T6`;
+
+#MEMORY
+SELECT LTRIM(`C1`) from `T7`;
+SELECT LTRIM(`C1`) from `T8`;
+SELECT LTRIM(`C1`) from `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_ps_sjis.test b/mysql-test/suite/jp/t/jp_ps_sjis.test
new file mode 100644
index 00000000..123ac904
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_ps_sjis.test
@@ -0,0 +1,348 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+
+--character_set sjis
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+DROP TABLE IF EXISTS t4;
+--enable_warnings
+
+#
+# Test Prepares Statement with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+### Test InnoDB ###
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = InnoDB;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = InnoDB;
+CREATE TABLE t3(
+ `` char(1),
+ `` char(1),
+ `\` char(1)
+)DEFAULT CHARSET = sjis ENGINE = InnoDB;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = sjis ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('\');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('\');
+
+# Japanese parameter for column name
+# the parameter for stmt is not interpreted as column name
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+# Japanese parameter for function argument
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,10,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,10,?) FROM t1';
+# Japanese parameter for UPDATE
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+
+## Test jisx0201 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0208 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+# Test jisx0212 ##
+SET @arg = '\';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+### Test MyISAM ###
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MyISAM;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MyISAM;
+CREATE TABLE t3(
+ `` char(1),
+ `` char(1),
+ `\` char(1)
+)DEFAULT CHARSET = sjis ENGINE = MyISAM;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = sjis ENGINE = MyISAM;
+
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('\');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('\' );
+
+# Japanese parameter for column name
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+# Japanese parameter for function argument
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,10,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,10,?) FROM t1';
+# Japanese parameter for UPDATE
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+
+## Test jisx0201 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0208 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0212 ##
+SET @arg = '\';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+### Test MEMORY ###
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MEMORY;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = sjis ENGINE = MEMORY;
+CREATE TABLE t3(
+ `` char(1),
+ `` char(1),
+ `\` char(1)
+)DEFAULT CHARSET = sjis ENGINE = MEMORY;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = sjis ENGINE =MEMORY;
+
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('\');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('\' );
+
+# Japanese parameter for column name
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+# Japanese parameter for function argument
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,10,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,10,?) FROM t1';
+# Japanese parameter for UPDATE
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+
+## Test jisx0201 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0208 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0212 ##
+SET @arg = '\';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/jp/t/jp_ps_ujis.test b/mysql-test/suite/jp/t/jp_ps_ujis.test
new file mode 100644
index 00000000..78b86ad5
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_ps_ujis.test
@@ -0,0 +1,347 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+DROP TABLE IF EXISTS t4;
+--enable_warnings
+
+#
+# Test Prepares Statement with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+### Test InnoDB ###
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
+CREATE TABLE t3(
+ `` char(1),
+ `` char(1),
+ `` char(1)
+)DEFAULT CHARSET = ujis ENGINE = InnoDB;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('');
+
+# Japanese parameter for column name
+# the parameter for stmt is not interpreted as column name
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+# Japanese parameter for function argument
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
+# Japanese parameter for UPDATE
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+
+## Test jisx0201 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0208 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+# Test jisx0212 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+### Test MyISAM ###
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
+CREATE TABLE t3(
+ `` char(1),
+ `` char(1),
+ `` char(1)
+)DEFAULT CHARSET = ujis ENGINE = MyISAM;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE = MyISAM;
+
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('' );
+
+# Japanese parameter for column name
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+# Japanese parameter for function argument
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
+# Japanese parameter for UPDATE
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+
+## Test jisx0201 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0208 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0212 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+### Test MEMORY ###
+CREATE TABLE t1(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MEMORY;
+CREATE TABLE t2(c1 char(3)) DEFAULT CHARSET = ujis ENGINE = MEMORY;
+CREATE TABLE t3(
+ `` char(1),
+ `` char(1),
+ `` char(1)
+)DEFAULT CHARSET = ujis ENGINE = MEMORY;
+CREATE TABLE t4(c1 char(1)) DEFAULT CHARSET = ujis ENGINE =MEMORY;
+
+INSERT INTO t1 VALUES ('xxx');
+INSERT INTO t2 VALUES ('');
+INSERT INTO t3 VALUES ('x','x','x'),('x','x','x'),('y','y','y'),('y','y','y'),('z','z','z'),('z','z','z');
+INSERT INTO t4 VALUES (''),(''),('' );
+
+# Japanese parameter for column name
+PREPARE stmt1 FROM 'SELECT ? FROM t3';
+PREPARE stmt2 FROM 'SELECT * FROM t3 ORDER BY ?';
+PREPARE stmt3 FROM 'SELECT COUNT(*) FROM t3 GROUP BY ?';
+# Japanese parameter for function argument
+PREPARE stmt4 FROM 'SELECT CHAR_LENGTH(?)';
+PREPARE stmt5 FROM 'SELECT CHARSET(?)';
+PREPARE stmt6 FROM 'SELECT INSERT(c1,1,1,?) FROM t1';
+PREPARE stmt7 FROM 'SELECT INSTR(c1,?) FROM t2';
+PREPARE stmt8 FROM 'SELECT LOCATE(?,c1) FROM t2';
+PREPARE stmt9 FROM 'SELECT LPAD(c1,9,?) FROM t1';
+PREPARE stmt10 FROM 'SELECT REPLACE(c1,?,\'x\') FROM t2';
+PREPARE stmt11 FROM 'SELECT REPLACE(c1,\'x\',?) FROM t1';
+PREPARE stmt12 FROM 'SELECT RPAD(c1,9,?) FROM t1';
+# Japanese parameter for UPDATE
+PREPARE stmt13 FROM 'UPDATE t4 SET c1=\'x\' WHERE c1=?';
+PREPARE stmt14 FROM 'UPDATE t4 SET c1=? WHERE c1=\'x\'';
+
+## Test jisx0201 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0208 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+## Test jisx0212 ##
+SET @arg = '';
+EXECUTE stmt1 USING @arg;
+EXECUTE stmt2 USING @arg;
+EXECUTE stmt3 USING @arg;
+EXECUTE stmt4 USING @arg;
+EXECUTE stmt5 USING @arg;
+EXECUTE stmt6 USING @arg;
+EXECUTE stmt7 USING @arg;
+EXECUTE stmt8 USING @arg;
+EXECUTE stmt9 USING @arg;
+EXECUTE stmt10 USING @arg;
+EXECUTE stmt11 USING @arg;
+EXECUTE stmt12 USING @arg;
+EXECUTE stmt13 USING @arg;
+SELECT * FROM t4;
+EXECUTE stmt14 USING @arg;
+SELECT * FROM t4;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DEALLOCATE PREPARE stmt3;
+DEALLOCATE PREPARE stmt4;
+DEALLOCATE PREPARE stmt5;
+DEALLOCATE PREPARE stmt6;
+DEALLOCATE PREPARE stmt7;
+DEALLOCATE PREPARE stmt8;
+DEALLOCATE PREPARE stmt9;
+DEALLOCATE PREPARE stmt10;
+DEALLOCATE PREPARE stmt11;
+DEALLOCATE PREPARE stmt12;
+DEALLOCATE PREPARE stmt13;
+DEALLOCATE PREPARE stmt14;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/jp/t/jp_replace_sjis.test b/mysql-test/suite/jp/t/jp_replace_sjis.test
new file mode 100644
index 00000000..ab29b875
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_replace_sjis.test
@@ -0,0 +1,102 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test REPLACE() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+
+#InnoDB
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+SELECT REPLACE(`bP`,'','') FROM `sP`;
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+SELECT REPLACE(`bP`,'','') FROM `sQ`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sR`;
+
+#MyISAM
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+SELECT REPLACE(`bP`,'','') FROM `sS`;
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+SELECT REPLACE(`bP`,'','') FROM `sT`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sU`;
+
+#MEMORY
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+SELECT REPLACE(`bP`,'','') FROM `sV`;
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+SELECT REPLACE(`bP`,'','') FROM `sW`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+SELECT REPLACE(`bP`,'\','\\') FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_replace_ucs2.test b/mysql-test/suite/jp/t/jp_replace_ucs2.test
new file mode 100644
index 00000000..fc9982ca
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_replace_ucs2.test
@@ -0,0 +1,103 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test REPLACE() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+
+#MyISAM
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+
+#MEMORY
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_replace_ujis.test b/mysql-test/suite/jp/t/jp_replace_ujis.test
new file mode 100644
index 00000000..a830dcd9
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_replace_ujis.test
@@ -0,0 +1,102 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test REPLACE() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+
+#MyISAM
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+
+#MEMORY
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','܏') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ݏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ޏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','ߏ') FROM `ԣ`;
+SELECT REPLACE(`ã`,'','') FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_replace_utf8.test b/mysql-test/suite/jp/t/jp_replace_utf8.test
new file mode 100644
index 00000000..fe5d3167
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_replace_utf8.test
@@ -0,0 +1,101 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test REPLACE() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+
+#InnoDB
+SELECT REPLACE(`C1`,'ア','アア') FROM `T1`;
+SELECT REPLACE(`C1`,'イ','イイ') FROM `T1`;
+SELECT REPLACE(`C1`,'ウ','ウウ') FROM `T1`;
+SELECT REPLACE(`C1`,'エ','エエ') FROM `T1`;
+SELECT REPLACE(`C1`,'オ','オオ') FROM `T1`;
+SELECT REPLACE(`C1`,'あ','ああ') FROM `T2`;
+SELECT REPLACE(`C1`,'い','いい') FROM `T2`;
+SELECT REPLACE(`C1`,'う','うう') FROM `T2`;
+SELECT REPLACE(`C1`,'え','ええ') FROM `T2`;
+SELECT REPLACE(`C1`,'お','おお') FROM `T2`;
+SELECT REPLACE(`C1`,'龔','龔龔') FROM `T3`;
+SELECT REPLACE(`C1`,'龖','龖龖') FROM `T3`;
+SELECT REPLACE(`C1`,'龗','龗龗') FROM `T3`;
+SELECT REPLACE(`C1`,'龞','龞龞') FROM `T3`;
+SELECT REPLACE(`C1`,'龡','龡龡') FROM `T3`;
+
+#MyISAM
+SELECT REPLACE(`C1`,'ア','アア') FROM `T4`;
+SELECT REPLACE(`C1`,'イ','イイ') FROM `T4`;
+SELECT REPLACE(`C1`,'ウ','ウウ') FROM `T4`;
+SELECT REPLACE(`C1`,'エ','エエ') FROM `T4`;
+SELECT REPLACE(`C1`,'オ','オオ') FROM `T4`;
+SELECT REPLACE(`C1`,'あ','ああ') FROM `T5`;
+SELECT REPLACE(`C1`,'い','いい') FROM `T5`;
+SELECT REPLACE(`C1`,'う','うう') FROM `T5`;
+SELECT REPLACE(`C1`,'え','ええ') FROM `T5`;
+SELECT REPLACE(`C1`,'お','おお') FROM `T5`;
+SELECT REPLACE(`C1`,'龔','龔龔') FROM `T6`;
+SELECT REPLACE(`C1`,'龖','龖龖') FROM `T6`;
+SELECT REPLACE(`C1`,'龗','龗龗') FROM `T6`;
+SELECT REPLACE(`C1`,'龞','龞龞') FROM `T6`;
+SELECT REPLACE(`C1`,'龡','龡龡') FROM `T6`;
+
+#MEMORY
+SELECT REPLACE(`C1`,'ア','アア') FROM `T7`;
+SELECT REPLACE(`C1`,'イ','イイ') FROM `T7`;
+SELECT REPLACE(`C1`,'ウ','ウウ') FROM `T7`;
+SELECT REPLACE(`C1`,'エ','エエ') FROM `T7`;
+SELECT REPLACE(`C1`,'オ','オオ') FROM `T7`;
+SELECT REPLACE(`C1`,'あ','ああ') FROM `T8`;
+SELECT REPLACE(`C1`,'い','いい') FROM `T8`;
+SELECT REPLACE(`C1`,'う','うう') FROM `T8`;
+SELECT REPLACE(`C1`,'え','ええ') FROM `T8`;
+SELECT REPLACE(`C1`,'お','おお') FROM `T8`;
+SELECT REPLACE(`C1`,'龔','龔龔') FROM `T9`;
+SELECT REPLACE(`C1`,'龖','龖龖') FROM `T9`;
+SELECT REPLACE(`C1`,'龗','龗龗') FROM `T9`;
+SELECT REPLACE(`C1`,'龞','龞龞') FROM `T9`;
+SELECT REPLACE(`C1`,'龡','龡龡') FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_reverse_sjis.test b/mysql-test/suite/jp/t/jp_reverse_sjis.test
new file mode 100644
index 00000000..2acc9bf9
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_reverse_sjis.test
@@ -0,0 +1,66 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test REVERSE() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+
+#InnoDB
+SELECT REVERSE(`bP`) FROM `sP`;
+SELECT REVERSE(`bP`) FROM `sQ`;
+SELECT REVERSE(`bP`) FROM `sR`;
+
+#MyISAM
+SELECT REVERSE(`bP`) FROM `sS`;
+SELECT REVERSE(`bP`) FROM `sT`;
+SELECT REVERSE(`bP`) FROM `sU`;
+
+#MEMORY
+SELECT REVERSE(`bP`) FROM `sV`;
+SELECT REVERSE(`bP`) FROM `sW`;
+SELECT REVERSE(`bP`) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_reverse_ucs2.test b/mysql-test/suite/jp/t/jp_reverse_ucs2.test
new file mode 100644
index 00000000..3bf2d492
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_reverse_ucs2.test
@@ -0,0 +1,67 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test REVERSE() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_reverse_ujis.test b/mysql-test/suite/jp/t/jp_reverse_ujis.test
new file mode 100644
index 00000000..0e6ea60e
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_reverse_ujis.test
@@ -0,0 +1,66 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test REVERSE() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+#InnoDB
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+SELECT REVERSE(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_reverse_utf8.test b/mysql-test/suite/jp/t/jp_reverse_utf8.test
new file mode 100644
index 00000000..ce49b571
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_reverse_utf8.test
@@ -0,0 +1,65 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test REVERSE() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+
+#InnoDB
+SELECT REVERSE(`C1`) FROM `T1`;
+SELECT REVERSE(`C1`) FROM `T2`;
+SELECT REVERSE(`C1`) FROM `T3`;
+
+#MyISAM
+SELECT REVERSE(`C1`) FROM `T4`;
+SELECT REVERSE(`C1`) FROM `T5`;
+SELECT REVERSE(`C1`) FROM `T6`;
+
+#MEMORY
+SELECT REVERSE(`C1`) FROM `T7`;
+SELECT REVERSE(`C1`) FROM `T8`;
+SELECT REVERSE(`C1`) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_right_sjis.test b/mysql-test/suite/jp/t/jp_right_sjis.test
new file mode 100644
index 00000000..8cde4233
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_right_sjis.test
@@ -0,0 +1,111 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test RIGHT() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, RIGHT(`bP`,0) FROM `sP`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sP`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sP`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sP`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sP`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sP`;
+SELECT `bP`, RIGHT(`bP`,0) FROM `sQ`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sQ`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sQ`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sQ`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sQ`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sQ`;
+SELECT `bP`, RIGHT(`bP`,0) FROM `sR`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sR`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sR`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sR`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sR`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sR`;
+
+#MyISAM
+SELECT `bP`, RIGHT(`bP`,0) FROM `sS`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sS`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sS`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sS`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sS`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sS`;
+SELECT `bP`, RIGHT(`bP`,0) FROM `sT`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sT`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sT`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sT`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sT`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sT`;
+SELECT `bP`, RIGHT(`bP`,0) FROM `sU`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sU`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sU`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sU`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sU`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, RIGHT(`bP`,0) FROM `sV`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sV`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sV`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sV`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sV`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sV`;
+SELECT `bP`, RIGHT(`bP`,0) FROM `sW`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sW`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sW`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sW`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sW`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sW`;
+SELECT `bP`, RIGHT(`bP`,0) FROM `sX`;
+SELECT `bP`, RIGHT(`bP`,1) FROM `sX`;
+SELECT `bP`, RIGHT(`bP`,2) FROM `sX`;
+SELECT `bP`, RIGHT(`bP`,3) FROM `sX`;
+SELECT `bP`, RIGHT(`bP`,4) FROM `sX`;
+SELECT `bP`, RIGHT(`bP`,5) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_right_ucs2.test b/mysql-test/suite/jp/t/jp_right_ucs2.test
new file mode 100644
index 00000000..bb914787
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_right_ucs2.test
@@ -0,0 +1,112 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test RIGHT() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_right_ujis.test b/mysql-test/suite/jp/t/jp_right_ujis.test
new file mode 100644
index 00000000..bb478af7
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_right_ujis.test
@@ -0,0 +1,111 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test RIGHT() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,0) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,1) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,2) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,3) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,4) FROM `ԣ`;
+SELECT `ã`, RIGHT(`ã`,5) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_right_utf8.test b/mysql-test/suite/jp/t/jp_right_utf8.test
new file mode 100644
index 00000000..0f435fb5
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_right_utf8.test
@@ -0,0 +1,110 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test RIGHT() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, RIGHT(`C1`,0) FROM `T1`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T1`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T1`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T1`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T1`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T1`;
+SELECT `C1`, RIGHT(`C1`,0) FROM `T2`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T2`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T2`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T2`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T2`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T2`;
+SELECT `C1`, RIGHT(`C1`,0) FROM `T3`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T3`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T3`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T3`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T3`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T3`;
+
+#MyISAM
+SELECT `C1`, RIGHT(`C1`,0) FROM `T4`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T4`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T4`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T4`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T4`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T4`;
+SELECT `C1`, RIGHT(`C1`,0) FROM `T5`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T5`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T5`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T5`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T5`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T5`;
+SELECT `C1`, RIGHT(`C1`,0) FROM `T6`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T6`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T6`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T6`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T6`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, RIGHT(`C1`,0) FROM `T7`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T7`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T7`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T7`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T7`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T7`;
+SELECT `C1`, RIGHT(`C1`,0) FROM `T8`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T8`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T8`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T8`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T8`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T8`;
+SELECT `C1`, RIGHT(`C1`,0) FROM `T9`;
+SELECT `C1`, RIGHT(`C1`,1) FROM `T9`;
+SELECT `C1`, RIGHT(`C1`,2) FROM `T9`;
+SELECT `C1`, RIGHT(`C1`,3) FROM `T9`;
+SELECT `C1`, RIGHT(`C1`,4) FROM `T9`;
+SELECT `C1`, RIGHT(`C1`,5) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_rpad_sjis.test b/mysql-test/suite/jp/t/jp_rpad_sjis.test
new file mode 100644
index 00000000..16715ee7
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rpad_sjis.test
@@ -0,0 +1,66 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test RPAD() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, RPAD(`bP`,5,'') FROM `sP`;
+SELECT `bP`, RPAD(`bP`,5,'w') FROM `sQ`;
+SELECT `bP`, RPAD(`bP`,5,'\') FROM `sR`;
+
+#MyISAM
+SELECT `bP`, RPAD(`bP`,5,'') FROM `sS`;
+SELECT `bP`, RPAD(`bP`,5,'w') FROM `sT`;
+SELECT `bP`, RPAD(`bP`,5,'\' ) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, RPAD(`bP`,5,'') FROM `sV`;
+SELECT `bP`, RPAD(`bP`,5,'w') FROM `sW`;
+SELECT `bP`, RPAD(`bP`,5,'\' ) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_rpad_ucs2.test b/mysql-test/suite/jp/t/jp_rpad_ucs2.test
new file mode 100644
index 00000000..9f39c20e
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rpad_ucs2.test
@@ -0,0 +1,67 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test RPAD() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_rpad_ujis.test b/mysql-test/suite/jp/t/jp_rpad_ujis.test
new file mode 100644
index 00000000..ad150f36
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rpad_ujis.test
@@ -0,0 +1,66 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test RPAD() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'') FROM `ԣ`;
+SELECT `ã`, RPAD(`ã`,5,'' ) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_rpad_utf8.test b/mysql-test/suite/jp/t/jp_rpad_utf8.test
new file mode 100644
index 00000000..329165f1
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rpad_utf8.test
@@ -0,0 +1,66 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test RPAD() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, RPAD(`C1`,5,'。') FROM `T1`;
+SELECT `C1`, RPAD(`C1`,5,'X') FROM `T2`;
+SELECT `C1`, RPAD(`C1`,5,'丄') FROM `T3`;
+
+#MyISAM
+SELECT `C1`, RPAD(`C1`,5,'。') FROM `T4`;
+SELECT `C1`, RPAD(`C1`,5,'X') FROM `T5`;
+SELECT `C1`, RPAD(`C1`,5,'丄' ) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, RPAD(`C1`,5,'。') FROM `T7`;
+SELECT `C1`, RPAD(`C1`,5,'X') FROM `T8`;
+SELECT `C1`, RPAD(`C1`,5,'丄' ) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_rtrim_sjis.test b/mysql-test/suite/jp/t/jp_rtrim_sjis.test
new file mode 100644
index 00000000..6a9ded05
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rtrim_sjis.test
@@ -0,0 +1,129 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test RTRIM() function with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(8), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+INSERT INTO `sP` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sP` VALUES ('@');
+INSERT INTO `sP` VALUES ('@@');
+INSERT INTO `sP` VALUES ('@@@');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+INSERT INTO `sQ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sQ` VALUES ('@');
+INSERT INTO `sQ` VALUES ('@@');
+INSERT INTO `sQ` VALUES ('@@@');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sR` VALUES ('\\\\\ ');
+INSERT INTO `sR` VALUES ('\\\\\ ');
+INSERT INTO `sR` VALUES ('\\\\\ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sR` VALUES ('\\\\\@');
+INSERT INTO `sR` VALUES ('\\\\\@@');
+INSERT INTO `sR` VALUES ('\\\\\@@@');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+INSERT INTO `sS` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sS` VALUES ('@');
+INSERT INTO `sS` VALUES ('@@');
+INSERT INTO `sS` VALUES ('@@@');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+INSERT INTO `sT` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sT` VALUES ('@');
+INSERT INTO `sT` VALUES ('@@');
+INSERT INTO `sT` VALUES ('@@@');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sU` VALUES ('\\\\\ ');
+INSERT INTO `sU` VALUES ('\\\\\ ');
+INSERT INTO `sU` VALUES ('\\\\\ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sU` VALUES ('\\\\\@');
+INSERT INTO `sU` VALUES ('\\\\\@@');
+INSERT INTO `sU` VALUES ('\\\\\@@@');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+INSERT INTO `sV` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sV` VALUES ('@');
+INSERT INTO `sV` VALUES ('@@');
+INSERT INTO `sV` VALUES ('@@@');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+INSERT INTO `sW` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sW` VALUES ('@');
+INSERT INTO `sW` VALUES ('@@');
+INSERT INTO `sW` VALUES ('@@@');
+INSERT INTO `sX` VALUES ('\\\\\');
+INSERT INTO `sX` VALUES ('\\\\\ ');
+INSERT INTO `sX` VALUES ('\\\\\ ');
+INSERT INTO `sX` VALUES ('\\\\\ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `sX` VALUES ('\\\\\@');
+INSERT INTO `sX` VALUES ('\\\\\@@');
+INSERT INTO `sX` VALUES ('\\\\\@@@');
+
+#InnoDB
+SELECT RTRIM(`bP`) from `sP`;
+SELECT RTRIM(`bP`) from `sQ`;
+SELECT RTRIM(`bP`) from `sR`;
+
+#MyISAM
+SELECT RTRIM(`bP`) from `sS`;
+SELECT RTRIM(`bP`) from `sT`;
+SELECT RTRIM(`bP`) from `sU`;
+
+#MEMORY
+SELECT RTRIM(`bP`) from `sV`;
+SELECT RTRIM(`bP`) from `sW`;
+SELECT RTRIM(`bP`) from `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_rtrim_ucs2.test b/mysql-test/suite/jp/t/jp_rtrim_ucs2.test
new file mode 100644
index 00000000..84cd1ce4
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rtrim_ucs2.test
@@ -0,0 +1,130 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test RTRIM() function with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+
+#InnoDB
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+
+#MyISAM
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+
+#MEMORY
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_rtrim_ujis.test b/mysql-test/suite/jp/t/jp_rtrim_ujis.test
new file mode 100644
index 00000000..5037419d
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rtrim_ujis.test
@@ -0,0 +1,129 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test RTRIM() function with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(8), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES (' ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏࡡ');
+
+#InnoDB
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+
+#MyISAM
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+
+#MEMORY
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+SELECT RTRIM(`ã`) from `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_rtrim_utf8.test b/mysql-test/suite/jp/t/jp_rtrim_utf8.test
new file mode 100644
index 00000000..f1161d16
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_rtrim_utf8.test
@@ -0,0 +1,128 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test RTRIM() function with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(8), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T1` VALUES ('アイウエオ ');
+INSERT INTO `T1` VALUES ('アイウエオ  ');
+INSERT INTO `T1` VALUES ('アイウエオ   ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T2` VALUES ('あいうえお ');
+INSERT INTO `T2` VALUES ('あいうえお  ');
+INSERT INTO `T2` VALUES ('あいうえお   ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T3` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡  ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡   ');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T4` VALUES ('アイウエオ ');
+INSERT INTO `T4` VALUES ('アイウエオ  ');
+INSERT INTO `T4` VALUES ('アイウエオ   ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T5` VALUES ('あいうえお ');
+INSERT INTO `T5` VALUES ('あいうえお  ');
+INSERT INTO `T5` VALUES ('あいうえお   ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T6` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡  ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡   ');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T7` VALUES ('アイウエオ ');
+INSERT INTO `T7` VALUES ('アイウエオ  ');
+INSERT INTO `T7` VALUES ('アイウエオ   ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T8` VALUES ('あいうえお ');
+INSERT INTO `T8` VALUES ('あいうえお  ');
+INSERT INTO `T8` VALUES ('あいうえお   ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+# Double byte spaces are not supposed to be trimed
+INSERT INTO `T9` VALUES ('龔龖龗龞龡 ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡  ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡   ');
+
+#InnoDB
+SELECT RTRIM(`C1`) from `T1`;
+SELECT RTRIM(`C1`) from `T2`;
+SELECT RTRIM(`C1`) from `T3`;
+
+#MyISAM
+SELECT RTRIM(`C1`) from `T4`;
+SELECT RTRIM(`C1`) from `T5`;
+SELECT RTRIM(`C1`) from `T6`;
+
+#MEMORY
+SELECT RTRIM(`C1`) from `T7`;
+SELECT RTRIM(`C1`) from `T8`;
+SELECT RTRIM(`C1`) from `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_select_sjis.test b/mysql-test/suite/jp/t/jp_select_sjis.test
new file mode 100644
index 00000000..f96dfadc
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_select_sjis.test
@@ -0,0 +1,69 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+
+#InnoDB
+SELECT * FROM `sP`;
+SELECT * FROM `sQ`;
+SELECT * FROM `sR`;
+#MyISAM
+SELECT * FROM `sS`;
+SELECT * FROM `sT`;
+SELECT * FROM `sU`;
+#MEMORY
+SELECT * FROM `sV`;
+SELECT * FROM `sW`;
+SELECT * FROM `sX`;
+
+drop table `sP`;
+drop table `sQ`;
+drop table `sR`;
+drop table `sS`;
+drop table `sT`;
+drop table `sU`;
+drop table `sV`;
+drop table `sW`;
+drop table `sX`;
diff --git a/mysql-test/suite/jp/t/jp_select_ucs2.test b/mysql-test/suite/jp/t/jp_select_ucs2.test
new file mode 100644
index 00000000..9acca2d6
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_select_ucs2.test
@@ -0,0 +1,135 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = heap;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = heap;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ucs2 engine = heap;
+
+#INSERT the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+#InnoDB
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+#MyISAM
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+#Heap
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_select_ujis.test b/mysql-test/suite/jp/t/jp_select_ujis.test
new file mode 100644
index 00000000..0c01e614
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_select_ujis.test
@@ -0,0 +1,69 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+
+#InnoDB
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+#MyISAM
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+#MEMORY
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
+drop table `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_select_utf8.test b/mysql-test/suite/jp/t/jp_select_utf8.test
new file mode 100644
index 00000000..08157cce
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_select_utf8.test
@@ -0,0 +1,68 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (c1 char(20), INDEX(c1)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+
+#InnoDB
+SELECT * FROM `T1`;
+SELECT * FROM `T2`;
+SELECT * FROM `T3`;
+#MyISAM
+SELECT * FROM `T4`;
+SELECT * FROM `T5`;
+SELECT * FROM `T6`;
+#MEMORY
+SELECT * FROM `T7`;
+SELECT * FROM `T8`;
+SELECT * FROM `T9`;
+
+drop table `T1`;
+drop table `T2`;
+drop table `T3`;
+drop table `T4`;
+drop table `T5`;
+drop table `T6`;
+drop table `T7`;
+drop table `T8`;
+drop table `T9`;
diff --git a/mysql-test/suite/jp/t/jp_subquery_sjis.test b/mysql-test/suite/jp/t/jp_subquery_sjis.test
new file mode 100644
index 00000000..aaaa71b0
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_subquery_sjis.test
@@ -0,0 +1,112 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test subquery using Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sPa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sPb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sRb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sSa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sSb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sTb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sUb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sVa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sVb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sWb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXa` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sXb` (`bP` char(1) PRIMARY KEY) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `sPa` VALUES (''),(''),('');
+INSERT INTO `sPb` VALUES ('');
+INSERT INTO `sQa` VALUES (''),(''),('');
+INSERT INTO `sQb` VALUES ('');
+INSERT INTO `sRa` VALUES ('\'),('\'),('\');
+INSERT INTO `sRb` VALUES ('\');
+INSERT INTO `sSa` VALUES (''),(''),('');
+INSERT INTO `sSb` VALUES ('');
+INSERT INTO `sTa` VALUES (''),(''),('');
+INSERT INTO `sTb` VALUES ('');
+INSERT INTO `sUa` VALUES ('\'),('\'),('\');
+INSERT INTO `sUb` VALUES ('\');
+INSERT INTO `sVa` VALUES (''),(''),('');
+INSERT INTO `sVb` VALUES ('');
+INSERT INTO `sWa` VALUES (''),(''),('');
+INSERT INTO `sWb` VALUES ('');
+INSERT INTO `sXa` VALUES ('\'),('\'),('\');
+INSERT INTO `sXb` VALUES ('\');
+
+#Test for innodb
+SELECT `bP` FROM `sPa` WHERE `bP` IN (SELECT `bP` FROM `sPb`);
+SELECT `bP` FROM `sPa` WHERE EXISTS (SELECT `bP` FROM `sPb` WHERE `sPa`.`bP` = `sPb`.`bP`);
+SELECT `bP` FROM `sPa` WHERE NOT EXISTS (SELECT `bP` FROM `sPb` WHERE `sPa`.`bP` = `sPb`.`bP`);
+SELECT `bP` FROM `sQa` WHERE `bP` IN (SELECT `bP` FROM `sQb`);
+SELECT `bP` FROM `sQa` WHERE EXISTS (SELECT `bP` FROM `sQb` WHERE `sQa`.`bP` = `sQb`.`bP`);
+SELECT `bP` FROM `sQa` WHERE NOT EXISTS (SELECT `bP` FROM `sQb` WHERE `sQa`.`bP` = `sQb`.`bP`);
+SELECT `bP` FROM `sRa` WHERE `bP` IN (SELECT `bP` FROM `sRb`);
+SELECT `bP` FROM `sRa` WHERE EXISTS (SELECT `bP` FROM `sRb` WHERE `sRa`.`bP` = `sRb`.`bP`);
+SELECT `bP` FROM `sRa` WHERE NOT EXISTS (SELECT `bP` FROM `sRb` WHERE `sRa`.`bP` = `sRb`.`bP`);
+SELECT `bP` FROM `sSa` WHERE `bP` IN (SELECT `bP` FROM `sSb`);
+SELECT `bP` FROM `sSa` WHERE EXISTS (SELECT `bP` FROM `sSb` WHERE `sSa`.`bP` = `sSb`.`bP`);
+SELECT `bP` FROM `sSa` WHERE NOT EXISTS (SELECT `bP` FROM `sSb` WHERE `sSa`.`bP` = `sSb`.`bP`);
+SELECT `bP` FROM `sTa` WHERE `bP` IN (SELECT `bP` FROM `sTb`);
+SELECT `bP` FROM `sTa` WHERE EXISTS (SELECT `bP` FROM `sTb` WHERE `sTa`.`bP` = `sTb`.`bP`);
+SELECT `bP` FROM `sTa` WHERE NOT EXISTS (SELECT `bP` FROM `sTb` WHERE `sTa`.`bP` = `sTb`.`bP`);
+SELECT `bP` FROM `sUa` WHERE `bP` IN (SELECT `bP` FROM `sUb`);
+SELECT `bP` FROM `sUa` WHERE EXISTS (SELECT `bP` FROM `sUb` WHERE `sUa`.`bP` = `sUb`.`bP`);
+SELECT `bP` FROM `sUa` WHERE NOT EXISTS (SELECT `bP` FROM `sUb` WHERE `sUa`.`bP` = `sUb`.`bP`);
+SELECT `bP` FROM `sVa` WHERE `bP` IN (SELECT `bP` FROM `sVb`);
+SELECT `bP` FROM `sVa` WHERE EXISTS (SELECT `bP` FROM `sVb` WHERE `sVa`.`bP` = `sVb`.`bP`);
+SELECT `bP` FROM `sVa` WHERE NOT EXISTS (SELECT `bP` FROM `sVb` WHERE `sVa`.`bP` = `sVb`.`bP`);
+SELECT `bP` FROM `sWa` WHERE `bP` IN (SELECT `bP` FROM `sWb`);
+SELECT `bP` FROM `sWa` WHERE EXISTS (SELECT `bP` FROM `sWb` WHERE `sWa`.`bP` = `sWb`.`bP`);
+SELECT `bP` FROM `sWa` WHERE NOT EXISTS (SELECT `bP` FROM `sWb` WHERE `sWa`.`bP` = `sWb`.`bP`);
+SELECT `bP` FROM `sXa` WHERE `bP` IN (SELECT `bP` FROM `sXb`);
+SELECT `bP` FROM `sXa` WHERE EXISTS (SELECT `bP` FROM `sXb` WHERE `sXa`.`bP` = `sXb`.`bP`);
+SELECT `bP` FROM `sXa` WHERE NOT EXISTS (SELECT `bP` FROM `sXb` WHERE `sXa`.`bP` = `sXb`.`bP`);
+
+DROP TABLE `sPa`;
+DROP TABLE `sPb`;
+DROP TABLE `sQa`;
+DROP TABLE `sQb`;
+DROP TABLE `sRa`;
+DROP TABLE `sRb`;
+DROP TABLE `sSa`;
+DROP TABLE `sSb`;
+DROP TABLE `sTa`;
+DROP TABLE `sTb`;
+DROP TABLE `sUa`;
+DROP TABLE `sUb`;
+DROP TABLE `sVa`;
+DROP TABLE `sVb`;
+DROP TABLE `sWa`;
+DROP TABLE `sWb`;
+DROP TABLE `sXa`;
+DROP TABLE `sXb`;
diff --git a/mysql-test/suite/jp/t/jp_subquery_ucs2.test b/mysql-test/suite/jp/t/jp_subquery_ucs2.test
new file mode 100644
index 00000000..1361235f
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_subquery_ucs2.test
@@ -0,0 +1,122 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+--enable_warnings
+
+#
+# Test subquery using Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+
+#Test for innodb
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/t/jp_subquery_ujis.test b/mysql-test/suite/jp/t/jp_subquery_ujis.test
new file mode 100644
index 00000000..1132f470
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_subquery_ujis.test
@@ -0,0 +1,121 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+DROP TABLE IF EXISTS `ԣa`;
+DROP TABLE IF EXISTS `ԣb`;
+--enable_warnings
+
+#
+# Test subquery using Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣa` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣb` (`ã` char(1) PRIMARY KEY) DEFAULT CHARSET = ujis engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+INSERT INTO `ԣa` VALUES (''),(''),('');
+INSERT INTO `ԣb` VALUES ('');
+
+#Test for innodb
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE `ã` IN (SELECT `ã` FROM `ԣb`);
+SELECT `ã` FROM `ԣa` WHERE EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+SELECT `ã` FROM `ԣa` WHERE NOT EXISTS (SELECT `ã` FROM `ԣb` WHERE `ԣa`.`ã` = `ԣb`.`ã`);
+
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
+DROP TABLE `ԣa`;
+DROP TABLE `ԣb`;
diff --git a/mysql-test/suite/jp/t/jp_subquery_utf8.test b/mysql-test/suite/jp/t/jp_subquery_utf8.test
new file mode 100644
index 00000000..c9df0a4a
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_subquery_utf8.test
@@ -0,0 +1,114 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test subquery using Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T1b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T4b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T7b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `T1a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T1b` VALUES ('ア');
+INSERT INTO `T2a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T2b` VALUES ('あ');
+INSERT INTO `T3a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T3b` VALUES ('龔');
+INSERT INTO `T4a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T4b` VALUES ('ア');
+INSERT INTO `T5a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T5b` VALUES ('あ');
+INSERT INTO `T6a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T6b` VALUES ('龔');
+INSERT INTO `T7a` VALUES ('ア'),('カ'),('サ');
+INSERT INTO `T7b` VALUES ('ア');
+INSERT INTO `T8a` VALUES ('あ'),('か'),('さ');
+INSERT INTO `T8b` VALUES ('あ');
+INSERT INTO `T9a` VALUES ('龔'),('龖'),('龗');
+INSERT INTO `T9b` VALUES ('龔');
+
+#Test for innodb
+SELECT `C1` FROM `T1a` WHERE `C1` IN (SELECT `C1` FROM `T1b`);
+SELECT `C1` FROM `T1a` WHERE EXISTS (SELECT `C1` FROM `T1b` WHERE `T1a`.`C1` = `T1b`.`C1`);
+SELECT `C1` FROM `T1a` WHERE NOT EXISTS (SELECT `C1` FROM `T1b` WHERE `T1a`.`C1` = `T1b`.`C1`);
+SELECT `C1` FROM `T2a` WHERE `C1` IN (SELECT `C1` FROM `T2b`);
+SELECT `C1` FROM `T2a` WHERE EXISTS (SELECT `C1` FROM `T2b` WHERE `T2a`.`C1` = `T2b`.`C1`);
+SELECT `C1` FROM `T2a` WHERE NOT EXISTS (SELECT `C1` FROM `T2b` WHERE `T2a`.`C1` = `T2b`.`C1`);
+SELECT `C1` FROM `T3a` WHERE `C1` IN (SELECT `C1` FROM `T3b`);
+SELECT `C1` FROM `T3a` WHERE EXISTS (SELECT `C1` FROM `T3b` WHERE `T3a`.`C1` = `T3b`.`C1`);
+SELECT `C1` FROM `T3a` WHERE NOT EXISTS (SELECT `C1` FROM `T3b` WHERE `T3a`.`C1` = `T3b`.`C1`);
+#Test for myisam
+SELECT `C1` FROM `T4a` WHERE `C1` IN (SELECT `C1` FROM `T4b`);
+SELECT `C1` FROM `T4a` WHERE EXISTS (SELECT `C1` FROM `T4b` WHERE `T4a`.`C1` = `T4b`.`C1`);
+SELECT `C1` FROM `T4a` WHERE NOT EXISTS (SELECT `C1` FROM `T4b` WHERE `T4a`.`C1` = `T4b`.`C1`);
+SELECT `C1` FROM `T5a` WHERE `C1` IN (SELECT `C1` FROM `T5b`);
+SELECT `C1` FROM `T5a` WHERE EXISTS (SELECT `C1` FROM `T5b` WHERE `T5a`.`C1` = `T5b`.`C1`);
+SELECT `C1` FROM `T5a` WHERE NOT EXISTS (SELECT `C1` FROM `T5b` WHERE `T5a`.`C1` = `T5b`.`C1`);
+SELECT `C1` FROM `T6a` WHERE `C1` IN (SELECT `C1` FROM `T6b`);
+SELECT `C1` FROM `T6a` WHERE EXISTS (SELECT `C1` FROM `T6b` WHERE `T6a`.`C1` = `T6b`.`C1`);
+SELECT `C1` FROM `T6a` WHERE NOT EXISTS (SELECT `C1` FROM `T6b` WHERE `T6a`.`C1` = `T6b`.`C1`);
+#Test for memory
+SELECT `C1` FROM `T7a` WHERE `C1` IN (SELECT `C1` FROM `T7b`);
+SELECT `C1` FROM `T7a` WHERE EXISTS (SELECT `C1` FROM `T7b` WHERE `T7a`.`C1` = `T7b`.`C1`);
+SELECT `C1` FROM `T7a` WHERE NOT EXISTS (SELECT `C1` FROM `T7b` WHERE `T7a`.`C1` = `T7b`.`C1`);
+SELECT `C1` FROM `T8a` WHERE `C1` IN (SELECT `C1` FROM `T8b`);
+SELECT `C1` FROM `T8a` WHERE EXISTS (SELECT `C1` FROM `T8b` WHERE `T8a`.`C1` = `T8b`.`C1`);
+SELECT `C1` FROM `T8a` WHERE NOT EXISTS (SELECT `C1` FROM `T8b` WHERE `T8a`.`C1` = `T8b`.`C1`);
+SELECT `C1` FROM `T9a` WHERE `C1` IN (SELECT `C1` FROM `T9b`);
+SELECT `C1` FROM `T9a` WHERE EXISTS (SELECT `C1` FROM `T9b` WHERE `T9a`.`C1` = `T9b`.`C1`);
+SELECT `C1` FROM `T9a` WHERE NOT EXISTS (SELECT `C1` FROM `T9b` WHERE `T9a`.`C1` = `T9b`.`C1`);
+
+DROP TABLE `T1a`;
+DROP TABLE `T1b`;
+DROP TABLE `T2a`;
+DROP TABLE `T2b`;
+DROP TABLE `T3a`;
+DROP TABLE `T3b`;
+DROP TABLE `T4a`;
+DROP TABLE `T4b`;
+DROP TABLE `T5a`;
+DROP TABLE `T5b`;
+DROP TABLE `T6a`;
+DROP TABLE `T6b`;
+DROP TABLE `T7a`;
+DROP TABLE `T7b`;
+DROP TABLE `T8a`;
+DROP TABLE `T8b`;
+DROP TABLE `T9a`;
+DROP TABLE `T9b`;
diff --git a/mysql-test/suite/jp/t/jp_substring_sjis.test b/mysql-test/suite/jp/t/jp_substring_sjis.test
new file mode 100644
index 00000000..5b956e8e
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_substring_sjis.test
@@ -0,0 +1,316 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test SUBSTRING() function with Japanese character in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sQ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sR` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sS` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sT` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sU` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+INSERT INTO `sV` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sW` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `sX` VALUES ('\\\\\'),('\\\\'),('\\\'),('\\'),('\'),('');
+
+#InnoDB
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sP`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sP`;
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sQ`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sQ`;
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sR`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sR`;
+
+#MyISAM
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sS`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sS`;
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sT`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sT`;
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sU`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sU`;
+
+#MEMORY
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sV`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sV`;
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sW`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sW`;
+
+SELECT `bP`, SUBSTRING(`bP`,0) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,2) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,3) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,4) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,5) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,6) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 0) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 2) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 3) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 4) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 5) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 6) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,0) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,1) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,2) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,3) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,4) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,5) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP`,1,6) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 0) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 1) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 2) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 3) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 4) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 5) FROM `sX`;
+SELECT `bP`, SUBSTRING(`bP` FROM 1 FOR 6) FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_substring_ucs2.test b/mysql-test/suite/jp/t/jp_substring_ucs2.test
new file mode 100644
index 00000000..febad324
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_substring_ucs2.test
@@ -0,0 +1,319 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test SUBSTRING() function with Japanese character in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+# Test of SUBSTRING(str,pos) and SUBSTRING(str FROM pos)
+# is not available until the bug #5364 is fixed
+
+#InnoDB
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#MyISAM
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#MEMORY
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+#SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_substring_ujis.test b/mysql-test/suite/jp/t/jp_substring_ujis.test
new file mode 100644
index 00000000..df35d91c
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_substring_ujis.test
@@ -0,0 +1,315 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test SUBSTRING() function with Japanese character in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES (''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ'),('܏ݏޏ'),('܏ݏ'),('܏'),(''),('');
+
+#InnoDB
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+SELECT `ã`, SUBSTRING(`ã`,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã`,1,6) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 0) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 1) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 2) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 3) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 4) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 5) FROM `ԣ`;
+SELECT `ã`, SUBSTRING(`ã` FROM 1 FOR 6) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_substring_utf8.test b/mysql-test/suite/jp/t/jp_substring_utf8.test
new file mode 100644
index 00000000..5408afd8
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_substring_utf8.test
@@ -0,0 +1,314 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test SUBSTRING() function with Japanese character in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T2` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T4` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T5` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+INSERT INTO `T7` VALUES ('アイウエオ'),('アイウエ'),('アイウ'),('アイ'),('ア'),('');
+INSERT INTO `T8` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
+
+#InnoDB
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T1`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T1`;
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T2`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T2`;
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T3`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T3`;
+
+#MyISAM
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T4`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T4`;
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T5`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T5`;
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T6`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T6`;
+
+#MEMORY
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T7`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T7`;
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T8`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T8`;
+
+SELECT `C1`, SUBSTRING(`C1`,0) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,2) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,3) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,4) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,5) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,6) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 0) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 2) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 3) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 4) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 5) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 6) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,0) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,1) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,2) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,3) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,4) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,5) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1`,1,6) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 0) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 1) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 2) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 3) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 4) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 5) FROM `T9`;
+SELECT `C1`, SUBSTRING(`C1` FROM 1 FOR 6) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_trim_sjis.test b/mysql-test/suite/jp/t/jp_trim_sjis.test
new file mode 100644
index 00000000..4a2b6b98
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_trim_sjis.test
@@ -0,0 +1,13 @@
+#
+# Test TRIM() function with Japanese characters sjis encoding
+#
+
+--source include/have_innodb.inc
+let $engine = innodb;
+--source suite/jp/include/trim_sjis.inc
+
+let $engine = myisam;
+--source suite/jp/include/trim_sjis.inc
+
+let $engine = memory;
+--source suite/jp/include/trim_sjis.inc
diff --git a/mysql-test/suite/jp/t/jp_trim_ucs2.test b/mysql-test/suite/jp/t/jp_trim_ucs2.test
new file mode 100644
index 00000000..e7205019
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_trim_ucs2.test
@@ -0,0 +1,173 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test TRIM() function with Japanese characters ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+# Nothing to trim
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM(TRAILING [remstr] FROM str)
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM(LEADING [remstr] FROM str)
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM(BOTH [remstr] FROM str)
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM without [remstr] (remove spaces)
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+
+#InnoDB
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING ''FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_trim_ujis.test b/mysql-test/suite/jp/t/jp_trim_ujis.test
new file mode 100644
index 00000000..658d066d
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_trim_ujis.test
@@ -0,0 +1,172 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test TRIM() function with Japanese characters ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(12), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+# Nothing to trim
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM(TRAILING [remstr] FROM str)
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM(LEADING [remstr] FROM str)
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM(BOTH [remstr] FROM str)
+INSERT INTO `ԣ` VALUES ('');
+# Test data for TRIM without [remstr] (remove spaces)
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES (' ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES (' ܏ݏޏߏ ');
+
+#InnoDB
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING ''FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+
+#MyISAM
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+
+#MEMORY
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(TRAILING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(LEADING '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(BOTH '' FROM `ã`) FROM `ԣ`;
+SELECT `ã`,TRIM(`ã`) FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_trim_utf8.test b/mysql-test/suite/jp/t/jp_trim_utf8.test
new file mode 100644
index 00000000..fd258869
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_trim_utf8.test
@@ -0,0 +1,171 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test TRIM() function with Japanese characters utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+# Nothing to trim
+INSERT INTO `T1` VALUES ('アイウエオ');
+# Test data for TRIM(TRAILING [remstr] FROM str)
+INSERT INTO `T1` VALUES ('アイウエオカ');
+INSERT INTO `T1` VALUES ('アイウエオカカ');
+INSERT INTO `T1` VALUES ('アイウエオカカカ');
+# Test data for TRIM(LEADING [remstr] FROM str)
+INSERT INTO `T1` VALUES ('カアイウエオ');
+INSERT INTO `T1` VALUES ('カカアイウエオ');
+INSERT INTO `T1` VALUES ('カカカアイウエオ');
+# Test data for TRIM(BOTH [remstr] FROM str)
+INSERT INTO `T1` VALUES ('カカカアイウエオカカカ');
+# Test data for TRIM without [remstr] (remove spaces)
+INSERT INTO `T1` VALUES (' アイウエオ ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T2` VALUES ('あいうえおか');
+INSERT INTO `T2` VALUES ('あいうえおかか');
+INSERT INTO `T2` VALUES ('あいうえおかかか');
+INSERT INTO `T2` VALUES ('かあいうえお');
+INSERT INTO `T2` VALUES ('かかあいうえお');
+INSERT INTO `T2` VALUES ('かかかあいうえお');
+INSERT INTO `T2` VALUES ('かかかあいうえおかかか');
+INSERT INTO `T2` VALUES (' あいうえお ');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡丂');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂丂');
+INSERT INTO `T3` VALUES ('丂龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('丂丂龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡');
+INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
+INSERT INTO `T3` VALUES (' 龔龖龗龞龡 ');
+
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T4` VALUES ('アイウエオカ');
+INSERT INTO `T4` VALUES ('アイウエオカカ');
+INSERT INTO `T4` VALUES ('アイウエオカカカ');
+INSERT INTO `T4` VALUES ('カアイウエオ');
+INSERT INTO `T4` VALUES ('カカアイウエオ');
+INSERT INTO `T4` VALUES ('カカカアイウエオ');
+INSERT INTO `T4` VALUES ('カカカアイウエオカカカ');
+INSERT INTO `T4` VALUES (' アイウエオ ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T5` VALUES ('あいうえおか');
+INSERT INTO `T5` VALUES ('あいうえおかか');
+INSERT INTO `T5` VALUES ('あいうえおかかか');
+INSERT INTO `T5` VALUES ('かあいうえお');
+INSERT INTO `T5` VALUES ('かかあいうえお');
+INSERT INTO `T5` VALUES ('かかかあいうえお');
+INSERT INTO `T5` VALUES ('かかかあいうえおかかか');
+INSERT INTO `T5` VALUES (' あいうえお ');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡丂');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂丂');
+INSERT INTO `T6` VALUES ('丂龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('丂丂龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡');
+INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
+INSERT INTO `T6` VALUES (' 龔龖龗龞龡 ');
+
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T7` VALUES ('アイウエオカ');
+INSERT INTO `T7` VALUES ('アイウエオカカ');
+INSERT INTO `T7` VALUES ('アイウエオカカカ');
+INSERT INTO `T7` VALUES ('カアイウエオ');
+INSERT INTO `T7` VALUES ('カカアイウエオ');
+INSERT INTO `T7` VALUES ('カカカアイウエオ');
+INSERT INTO `T7` VALUES ('カカカアイウエオカカカ');
+INSERT INTO `T7` VALUES (' アイウエオ ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T8` VALUES ('あいうえおか');
+INSERT INTO `T8` VALUES ('あいうえおかか');
+INSERT INTO `T8` VALUES ('あいうえおかかか');
+INSERT INTO `T8` VALUES ('かあいうえお');
+INSERT INTO `T8` VALUES ('かかあいうえお');
+INSERT INTO `T8` VALUES ('かかかあいうえお');
+INSERT INTO `T8` VALUES ('かかかあいうえおかかか');
+INSERT INTO `T8` VALUES (' あいうえお ');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡丂');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂丂');
+INSERT INTO `T9` VALUES ('丂龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('丂丂龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡');
+INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
+INSERT INTO `T9` VALUES (' 龔龖龗龞龡 ');
+
+#InnoDB
+SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T1`;
+SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T1`;
+SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T1`;
+SELECT `C1`,TRIM(`C1`) FROM `T1`;
+SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T2`;
+SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T2`;
+SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T2`;
+SELECT `C1`,TRIM(`C1`) FROM `T2`;
+SELECT `C1`,TRIM(TRAILING '丂'FROM `C1`) FROM `T3`;
+SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T3`;
+SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T3`;
+SELECT `C1`,TRIM(`C1`) FROM `T3`;
+
+#MyISAM
+SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T4`;
+SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T4`;
+SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T4`;
+SELECT `C1`,TRIM(`C1`) FROM `T4`;
+SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T5`;
+SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T5`;
+SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T5`;
+SELECT `C1`,TRIM(`C1`) FROM `T5`;
+SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T6`;
+SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T6`;
+SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T6`;
+SELECT `C1`,TRIM(`C1`) FROM `T6`;
+
+#MEMORY
+SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T7`;
+SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T7`;
+SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T7`;
+SELECT `C1`,TRIM(`C1`) FROM `T7`;
+SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T8`;
+SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T8`;
+SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T8`;
+SELECT `C1`,TRIM(`C1`) FROM `T8`;
+SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T9`;
+SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T9`;
+SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T9`;
+SELECT `C1`,TRIM(`C1`) FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_union_ujis.test b/mysql-test/suite/jp/t/jp_union_ujis.test
new file mode 100644
index 00000000..73c9c660
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_union_ujis.test
@@ -0,0 +1,103 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test UNION with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+#InnoDB
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+(SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) UNION (SELECT '') ORDER BY `ã`;
+(SELECT '' AS `ã`) UNION (SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) ORDER BY `ã`;
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` UNION
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION SELECT REPEAT(`ã`,5) FROM `ԣ` ORDER BY `ã`;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+
+#MyISAM
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MYISAM;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MYISAM;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MYISAM;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+(SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) UNION (SELECT '') ORDER BY `ã`;
+(SELECT '' AS `ã`) UNION (SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) ORDER BY `ã`;
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` UNION
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION SELECT REPEAT(`ã`,5) FROM `ԣ` ORDER BY `ã`;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+
+#MEMORY
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+(SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) UNION (SELECT '') ORDER BY `ã`;
+(SELECT '' AS `ã`) UNION (SELECT * FROM `ԣ`) UNION (SELECT * FROM `ԣ`) ORDER BY `ã`;
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` UNION
+SELECT `ã`, COUNT(*) FROM `ԣ` GROUP BY `ã` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL
+SELECT * FROM `ԣ` UNION DISTINCT
+SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION SELECT REPEAT(`ã`,5) FROM `ԣ` ORDER BY `ã`;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+DROP TABLE `ԣ` ;
+
+# Test mixed strage engine
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = InnoDB;
+CREATE TABLE `ԣ` (`ã` char(1), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MyISAM;
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+INSERT INTO `ԣ` VALUES(''),(''),(''),(''),(''),('');
+SELECT * FROM `ԣ` UNION DISTINCT SELECT * FROM `ԣ` ORDER BY `ã`;
+SELECT * FROM `ԣ` UNION ALL SELECT * FROM `ԣ` ORDER BY `ã`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_update_sjis.test b/mysql-test/suite/jp/t/jp_update_sjis.test
new file mode 100644
index 00000000..b977df5f
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_update_sjis.test
@@ -0,0 +1,76 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test Updating with Japanese characters in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(5), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+INSERT INTO `sP` VALUES ('');
+INSERT INTO `sQ` VALUES ('');
+INSERT INTO `sR` VALUES ('\\\\\');
+INSERT INTO `sS` VALUES ('');
+INSERT INTO `sT` VALUES ('');
+INSERT INTO `sU` VALUES ('\\\\\');
+INSERT INTO `sV` VALUES ('');
+INSERT INTO `sW` VALUES ('');
+INSERT INTO `sX` VALUES ('\\\\\');
+
+UPDATE `sP` SET `bP` = ('');
+UPDATE `sQ` SET `bP` = ('');
+UPDATE `sR` SET `bP` = ('\\\\\');
+UPDATE `sS` SET `bP` = ('');
+UPDATE `sT` SET `bP` = ('');
+UPDATE `sU` SET `bP` = ('\\\\\');
+UPDATE `sV` SET `bP` = ('');
+UPDATE `sW` SET `bP` = ('');
+UPDATE `sX` SET `bP` = ('\\\\\');
+
+#InnoDB
+SELECT * FROM `sP`;
+SELECT * FROM `sQ`;
+SELECT * FROM `sR`;
+
+#MyISAM
+SELECT * FROM `sS`;
+SELECT * FROM `sT`;
+SELECT * FROM `sU`;
+
+#MEMORY
+SELECT * FROM `sV`;
+SELECT * FROM `sW`;
+SELECT * FROM `sX`;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_update_ucs2.test b/mysql-test/suite/jp/t/jp_update_ucs2.test
new file mode 100644
index 00000000..33a5ce63
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_update_ucs2.test
@@ -0,0 +1,77 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test Updating with Japanese characters in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+
+#InnoDB
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+#MyISAM
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+#MEMORY
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_update_ujis.test b/mysql-test/suite/jp/t/jp_update_ujis.test
new file mode 100644
index 00000000..3ba00946
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_update_ujis.test
@@ -0,0 +1,76 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test Updating with Japanese characters in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(5), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('');
+INSERT INTO `ԣ` VALUES ('܏ݏޏߏ');
+
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('');
+UPDATE `ԣ` SET `ã` = ('ȏɏʏˏ');
+
+#InnoDB
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+#MyISAM
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+#MEMORY
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+SELECT * FROM `ԣ`;
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_update_utf8.test b/mysql-test/suite/jp/t/jp_update_utf8.test
new file mode 100644
index 00000000..8dbd046a
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_update_utf8.test
@@ -0,0 +1,75 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test Updating with Japanese characters in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(5), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+INSERT INTO `T1` VALUES ('アイウエオ');
+INSERT INTO `T2` VALUES ('あいうえお');
+INSERT INTO `T3` VALUES ('龔龖龗龞龡');
+INSERT INTO `T4` VALUES ('アイウエオ');
+INSERT INTO `T5` VALUES ('あいうえお');
+INSERT INTO `T6` VALUES ('龔龖龗龞龡');
+INSERT INTO `T7` VALUES ('アイウエオ');
+INSERT INTO `T8` VALUES ('あいうえお');
+INSERT INTO `T9` VALUES ('龔龖龗龞龡');
+
+UPDATE `T1` SET `C1` = ('カキクケコ');
+UPDATE `T2` SET `C1` = ('かきくけこ');
+UPDATE `T3` SET `C1` = ('齗齘齚齝齞');
+UPDATE `T4` SET `C1` = ('カキクケコ');
+UPDATE `T5` SET `C1` = ('かきくけこ');
+UPDATE `T6` SET `C1` = ('齗齘齚齝齞');
+UPDATE `T7` SET `C1` = ('カキクケコ');
+UPDATE `T8` SET `C1` = ('かきくけこ');
+UPDATE `T9` SET `C1` = ('齗齘齚齝齞');
+
+#InnoDB
+SELECT * FROM `T1`;
+SELECT * FROM `T2`;
+SELECT * FROM `T3`;
+
+#MyISAM
+SELECT * FROM `T4`;
+SELECT * FROM `T5`;
+SELECT * FROM `T6`;
+
+#MEMORY
+SELECT * FROM `T7`;
+SELECT * FROM `T8`;
+SELECT * FROM `T9`;
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;
diff --git a/mysql-test/suite/jp/t/jp_where_sjis.test b/mysql-test/suite/jp/t/jp_where_sjis.test
new file mode 100644
index 00000000..37490572
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_where_sjis.test
@@ -0,0 +1,93 @@
+--source include/have_sjis.inc
+--source include/have_innodb.inc
+--character_set sjis
+--disable_warnings
+drop table if exists `sP`;
+drop table if exists `sQ`;
+drop table if exists `sR`;
+drop table if exists `sS`;
+drop table if exists `sT`;
+drop table if exists `sU`;
+drop table if exists `sV`;
+drop table if exists `sW`;
+drop table if exists `sX`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact using WHERE condtion in sjis encoding
+#
+
+SET NAMES sjis;
+SET character_set_database = sjis;
+
+CREATE TABLE `sP` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sQ` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sR` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = innodb;
+CREATE TABLE `sS` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sT` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sU` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = myisam;
+CREATE TABLE `sV` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sW` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+CREATE TABLE `sX` (`bP` char(20), INDEX(`bP`)) DEFAULT CHARSET = sjis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sP`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sQ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sR`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sS`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sT`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sU`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `sV`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `sW`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `sX`;
+
+#InnoDB
+SELECT * FROM `sP` WHERE `bP` = '';
+SELECT * FROM `sQ` WHERE `bP` = 'E';
+SELECT * FROM `sR` WHERE `bP` = '\\\\\\\\\\\\\\\\\\\\';
+
+#MyISAM
+SELECT * FROM `sS` WHERE `bP` = '';
+SELECT * FROM `sT` WHERE `bP` = 'E';
+SELECT * FROM `sU` WHERE `bP` = '\\\\\\\\\\\\\\\\\\\\';
+
+#MEMORY
+SELECT * FROM `sV` WHERE `bP` = '';
+SELECT * FROM `sW` WHERE `bP` = 'E';
+SELECT * FROM `sX` WHERE `bP` = '\\\\\\\\\\\\\\\\\\\\';
+
+#Test to distinguish 0x9353 and 0x9373
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+--enable_warnings
+CREATE TABLE t1(c1 char(1)) default charset = sjis engine=innodb;
+CREATE TABLE t2(c1 char(1)) default charset = sjis engine=myisam;
+CREATE TABLE t3(c1 char(1)) default charset = sjis engine=MEMORY;
+INSERT INTO t1 VALUES('S'),('s');
+INSERT INTO t2 VALUES('S'),('s');
+INSERT INTO t3 VALUES('S'),('s');
+SELECT * FROM t1 WHERE c1 = 'S';
+SELECT * FROM t2 WHERE c1 = 'S';
+SELECT * FROM t3 WHERE c1 = 'S';
+SELECT * FROM t1 WHERE c1 = 's';
+SELECT * FROM t2 WHERE c1 = 's';
+SELECT * FROM t3 WHERE c1 = 's';
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+DROP TABLE `sP`;
+DROP TABLE `sQ`;
+DROP TABLE `sR`;
+DROP TABLE `sS`;
+DROP TABLE `sT`;
+DROP TABLE `sU`;
+DROP TABLE `sV`;
+DROP TABLE `sW`;
+DROP TABLE `sX`;
diff --git a/mysql-test/suite/jp/t/jp_where_ucs2.test b/mysql-test/suite/jp/t/jp_where_ucs2.test
new file mode 100644
index 00000000..7e035cd2
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_where_ucs2.test
@@ -0,0 +1,137 @@
+--source include/have_ucs2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact using WHERE condtion in ucs2 encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ucs2;
+SET collation_connection = ucs2_general_ci;
+
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
+
+#Insert the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+INSERT INTO `ԣ` VALUES
+ ('PQRSTUVWXYZ[\\]^_')
+,(' ')
+,('')
+,('ŽÎĎŎƎǎȎɎʎˎ͎̎Ύ')
+,('ЎюҎӎԎՎ֎׎؎َڎێ܎ݎގ');
+
+INSERT INTO `ԣ` VALUES
+ ('¡áġšơ')
+,('ȡɡʡˡ̡͡ΡϡСѡҡӡԡա֡סء١ڡ')
+,('')
+,('')
+,('')
+,('СТУФХЦЧШЩЪЫЬЭЮЯабвг')
+,('');
+
+INSERT INTO `ԣ` VALUES
+ ('Ïġ')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ')
+,('܏ݏޏߏᏰ⏰㏰䏰台揰珰菰鏰ꏰ돰쏰폰')
+,('')
+,('ÏďŏƏ')
+,('ȏɏʏˏ̏͏ΏϏЏяҏӏԏՏ֏׏؏ُڏ');
+
+#InnoDB
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+
+#MyISAM
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+
+#MEMORY
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_where_ujis.test b/mysql-test/suite/jp/t/jp_where_ujis.test
new file mode 100644
index 00000000..ce39e267
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_where_ujis.test
@@ -0,0 +1,71 @@
+--source include/have_ujis.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+drop table if exists `ԣ`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact using WHERE condtion in ujis encoding
+#
+
+SET NAMES ujis;
+SET character_set_database = ujis;
+
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = innodb;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = myisam;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+CREATE TABLE `ԣ` (`ã` char(20), INDEX(`ã`)) DEFAULT CHARSET = ujis engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_ujis.dat' INTO TABLE `ԣ`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_ujis.dat' INTO TABLE `ԣ`;
+
+#InnoDB
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+
+#MyISAM
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+
+#MEMORY
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = '';
+SELECT * FROM `ԣ` WHERE `ã` = 'ÏďŏƏ';
+
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
+DROP TABLE `ԣ`;
diff --git a/mysql-test/suite/jp/t/jp_where_utf8.test b/mysql-test/suite/jp/t/jp_where_utf8.test
new file mode 100644
index 00000000..97234ff1
--- /dev/null
+++ b/mysql-test/suite/jp/t/jp_where_utf8.test
@@ -0,0 +1,70 @@
+--source include/have_utf8.inc
+--source include/have_innodb.inc
+--disable_warnings
+drop table if exists `T1`;
+drop table if exists `T2`;
+drop table if exists `T3`;
+drop table if exists `T4`;
+drop table if exists `T5`;
+drop table if exists `T6`;
+drop table if exists `T7`;
+drop table if exists `T8`;
+drop table if exists `T9`;
+--enable_warnings
+
+#
+# Test Displaying Japanese charact using WHERE condition in utf8 encoding
+#
+
+SET NAMES utf8;
+SET character_set_database = utf8;
+
+CREATE TABLE `T1` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T2` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T3` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
+CREATE TABLE `T4` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T5` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T6` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
+CREATE TABLE `T7` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T8` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+CREATE TABLE `T9` (`C1` char(20), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = MEMORY;
+
+#Load the following data in each table
+# jisx0201 hankaku-katakana data
+# jisx0208 data
+# jisx0212 supplemental character data
+
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T1`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T2`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T3`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T4`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T5`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T6`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `T7`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `T8`;
+LOAD DATA LOCAL INFILE 'suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `T9`;
+
+#InnoDB
+SELECT * FROM `T1` WHERE `C1` = 'ーアイウエオカキクケコサシスセソ';
+SELECT * FROM `T2` WHERE `C1` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+SELECT * FROM `T3` WHERE `C1` = '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+
+#MyISAM
+SELECT * FROM `T4` WHERE `C1` = 'ーアイウエオカキクケコサシスセソ';
+SELECT * FROM `T5` WHERE `C1` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+SELECT * FROM `T6` WHERE `C1` = '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+
+#MEMORY
+SELECT * FROM `T7` WHERE `C1` = 'ーアイウエオカキクケコサシスセソ';
+SELECT * FROM `T8` WHERE `C1` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
+SELECT * FROM `T9` WHERE `C1` = '鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃齄齅齆齇齓齕齖';
+
+DROP TABLE `T1`;
+DROP TABLE `T2`;
+DROP TABLE `T3`;
+DROP TABLE `T4`;
+DROP TABLE `T5`;
+DROP TABLE `T6`;
+DROP TABLE `T7`;
+DROP TABLE `T8`;
+DROP TABLE `T9`;