diff options
author | unknown <bar@bar.intranet.mysql.r18.ru> | 2004-03-25 14:29:56 +0400 |
---|---|---|
committer | unknown <bar@bar.intranet.mysql.r18.ru> | 2004-03-25 14:29:56 +0400 |
commit | af4ff07fe4fa9d0b21e9128aa620735a842449b4 (patch) | |
tree | 66961a21a84d12cae3451369d10555a56d0e1054 | |
parent | 4cdc50de82f1f83c4b2fa5446deefc9b8a1dd92a (diff) | |
download | mariadb-git-af4ff07fe4fa9d0b21e9128aa620735a842449b4.tar.gz |
#3290: Can't convert sjis&ujis half-width katakana correctly
-rw-r--r-- | mysql-test/include/have_sjis.inc | 4 | ||||
-rw-r--r-- | mysql-test/r/ctype_sjis.result | 43 | ||||
-rw-r--r-- | mysql-test/r/have_sjis.require | 2 | ||||
-rw-r--r-- | mysql-test/t/ctype_sjis.test | 34 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 14 |
5 files changed, 96 insertions, 1 deletions
diff --git a/mysql-test/include/have_sjis.inc b/mysql-test/include/have_sjis.inc new file mode 100644 index 00000000000..0d580a3a232 --- /dev/null +++ b/mysql-test/include/have_sjis.inc @@ -0,0 +1,4 @@ +-- require r/have_sjis.require +disable_query_log; +show collation like "sjis_japanese_ci"; +enable_query_log; diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result new file mode 100644 index 00000000000..1e3e28784a5 --- /dev/null +++ b/mysql-test/r/ctype_sjis.result @@ -0,0 +1,43 @@ +drop table if exists t1; +set names sjis; +select 'a' like 'a'; +'a' like 'a' +1 +select 'A' like 'a'; +'A' like 'a' +1 +select 'A' like 'a' collate sjis_bin; +'A' like 'a' collate sjis_bin +0 +set @sjis1= _sjis 0xa1a2a3a4a5a6a7a8a9aaabacadaeaf; +set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf; +set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf; +set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf; +set @utf81= CONVERT(@sjis1 USING utf8); +set @utf82= CONVERT(@sjis2 USING utf8); +set @utf83= CONVERT(@sjis3 USING utf8); +set @utf84= CONVERT(@sjis4 USING utf8); +select hex(@utf81); +hex(@utf81) +EFBDA1EFBDA2EFBDA3EFBDA4EFBDA5EFBDA6EFBDA7EFBDA8EFBDA9EFBDAAEFBDABEFBDACEFBDADEFBDAEEFBDAF +select hex(@utf82); +hex(@utf82) +EFBDB0EFBDB1EFBDB2EFBDB3EFBDB4EFBDB5EFBDB6EFBDB7EFBDB8EFBDB9EFBDBAEFBDBBEFBDBCEFBDBDEFBDBEEFBDBF +select hex(@utf83); +hex(@utf83) +EFBE80EFBE81EFBE82EFBE83EFBE84EFBE85EFBE86EFBE87EFBE88EFBE89EFBE8AEFBE8BEFBE8CEFBE8DEFBE8EEFBE8F +select hex(@utf84); +hex(@utf84) +EFBE90EFBE91EFBE92EFBE93EFBE94EFBE95EFBE96EFBE97EFBE98EFBE99EFBE9AEFBE9BEFBE9CEFBE9DEFBE9EEFBE9F +select hex(CONVERT(@utf81 USING sjis)); +hex(CONVERT(@utf81 USING sjis)) +A1A2A3A4A5A6A7A8A9AAABACADAEAF +select hex(CONVERT(@utf82 USING sjis)); +hex(CONVERT(@utf82 USING sjis)) +B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF +select hex(CONVERT(@utf83 USING sjis)); +hex(CONVERT(@utf83 USING sjis)) +C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF +select hex(CONVERT(@utf84 USING sjis)); +hex(CONVERT(@utf84 USING sjis)) +D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF diff --git a/mysql-test/r/have_sjis.require b/mysql-test/r/have_sjis.require new file mode 100644 index 00000000000..72ce8ec88fe --- /dev/null +++ b/mysql-test/r/have_sjis.require @@ -0,0 +1,2 @@ +Collation Charset Id Default Compiled Sortlen +sjis_japanese_ci sjis 13 Yes Yes 1 diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test new file mode 100644 index 00000000000..1dd363c4910 --- /dev/null +++ b/mysql-test/t/ctype_sjis.test @@ -0,0 +1,34 @@ +-- source include/have_sjis.inc + +# +# Tests with the sjis character set +# +--disable_warnings +drop table if exists t1; +--enable_warnings + +set names sjis; + +select 'a' like 'a'; +select 'A' like 'a'; +select 'A' like 'a' collate sjis_bin; + +set @sjis1= _sjis 0xa1a2a3a4a5a6a7a8a9aaabacadaeaf; +set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf; +set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf; +set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf; + +set @utf81= CONVERT(@sjis1 USING utf8); +set @utf82= CONVERT(@sjis2 USING utf8); +set @utf83= CONVERT(@sjis3 USING utf8); +set @utf84= CONVERT(@sjis4 USING utf8); + +select hex(@utf81); +select hex(@utf82); +select hex(@utf83); +select hex(@utf84); + +select hex(CONVERT(@utf81 USING sjis)); +select hex(CONVERT(@utf82 USING sjis)); +select hex(CONVERT(@utf83 USING sjis)); +select hex(CONVERT(@utf84 USING sjis)); diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index c337b8122fb..8ba650d1486 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4437,6 +4437,12 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), if (!(code=func_uni_sjis_onechar(wc))) return MY_CS_ILUNI; + if (code>=0xA1 && code <= 0xDF) + { + s[0]= code; + return 1; + } + if (s+2>e) return MY_CS_TOOSMALL; @@ -4454,12 +4460,18 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), if (s >= e) return MY_CS_TOOFEW(0); - if (hi<0x80) + if (hi < 0x80) { pwc[0]=hi; return 1; } + if (hi >= 0xA1 && hi <= 0xDF) + { + pwc[0]= func_sjis_uni_onechar(hi); + return 1; + } + if (s+2>e) return MY_CS_TOOFEW(0); |