Commit af4ff07f authored by unknown's avatar unknown

#3290: Can't convert sjis&ujis half-width katakana correctly

parent 4cdc50de
-- require r/have_sjis.require
disable_query_log;
show collation like "sjis_japanese_ci";
enable_query_log;
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
Collation Charset Id Default Compiled Sortlen
sjis_japanese_ci sjis 13 Yes Yes 1
-- 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));
...@@ -4437,6 +4437,12 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), ...@@ -4437,6 +4437,12 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (!(code=func_uni_sjis_onechar(wc))) if (!(code=func_uni_sjis_onechar(wc)))
return MY_CS_ILUNI; return MY_CS_ILUNI;
if (code>=0xA1 && code <= 0xDF)
{
s[0]= code;
return 1;
}
if (s+2>e) if (s+2>e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
...@@ -4454,12 +4460,18 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), ...@@ -4454,12 +4460,18 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e) if (s >= e)
return MY_CS_TOOFEW(0); return MY_CS_TOOFEW(0);
if (hi<0x80) if (hi < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;
} }
if (hi >= 0xA1 && hi <= 0xDF)
{
pwc[0]= func_sjis_uni_onechar(hi);
return 1;
}
if (s+2>e) if (s+2>e)
return MY_CS_TOOFEW(0); return MY_CS_TOOFEW(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment