summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/ctype_sjis.result11
-rw-r--r--mysql-test/t/ctype_sjis.test11
-rw-r--r--strings/ctype-sjis.c9
3 files changed, 29 insertions, 2 deletions
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index b0edbed1a41..944fa0602a9 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -60,3 +60,14 @@ hex(c)
9353
9373
drop table t1;
+SET NAMES sjis;
+CREATE TABLE t1 (
+c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+hex(c)
+B1
+B2
+B3
+drop table t1;
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
index c910812ef8a..a3a44789975 100644
--- a/mysql-test/t/ctype_sjis.test
+++ b/mysql-test/t/ctype_sjis.test
@@ -51,3 +51,14 @@ insert into t1 values (0x9353);
insert into t1 values (0x9373);
select hex(c) from t1;
drop table t1;
+
+#
+# Bug #6223 Japanese half-width kana characters get truncated
+#
+SET NAMES sjis;
+CREATE TABLE t1 (
+ c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+drop table t1;
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 4176ff2e538..a8b5394f8c5 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4581,14 +4581,19 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
*/
if (((int8)b[0]) >= 0)
{
- /* Single byte character */
- b+= 1;
+ /* Single byte ascii character */
+ b++;
}
else if (issjishead((uchar)*b) && (e-b)>1 && issjistail((uchar)b[1]))
{
/* Double byte character */
b+= 2;
}
+ else if (((uchar)*b) >= 0xA1 && ((uchar)*b) <= 0xDF)
+ {
+ /* Half width kana */
+ b++;
+ }
else
{
/* Wrong byte sequence */