Commit 7674fd06 authored by unknown's avatar unknown

Bug #3290 [Ver]: Can't convert sjis&ujis half-width katakana correctly

UJIS part fix

parent 65bed530
......@@ -64,3 +64,31 @@ select 'A' like 'a';
select 'A' like 'a' collate ujis_bin;
'A' like 'a' collate ujis_bin
0
set @ujis1= _ujis 0x8EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAB8EAC8EAD8EAE8EAF;
set @ujis2= _ujis 0x8EB08EB18EB28EB38EB48EB58EB68EB78EB88EB98EBA8EBB8EBC8EBD8EBE8EBF;
set @ujis3= _ujis 0x8EC08EC18EC28EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECE8ECF;
set @ujis4= _ujis 0x8ED08ED18ED28ED38ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF;
select hex(@utf81:= CONVERT(@ujis1 USING utf8));
hex(@utf81:= CONVERT(@ujis1 USING utf8))
EFBDA1EFBDA2EFBDA3EFBDA4EFBDA5EFBDA6EFBDA7EFBDA8EFBDA9EFBDAAEFBDABEFBDACEFBDADEFBDAEEFBDAF
select hex(@utf82:= CONVERT(@ujis2 USING utf8));
hex(@utf82:= CONVERT(@ujis2 USING utf8))
EFBDB0EFBDB1EFBDB2EFBDB3EFBDB4EFBDB5EFBDB6EFBDB7EFBDB8EFBDB9EFBDBAEFBDBBEFBDBCEFBDBDEFBDBEEFBDBF
select hex(@utf83:= CONVERT(@ujis3 USING utf8));
hex(@utf83:= CONVERT(@ujis3 USING utf8))
EFBE80EFBE81EFBE82EFBE83EFBE84EFBE85EFBE86EFBE87EFBE88EFBE89EFBE8AEFBE8BEFBE8CEFBE8DEFBE8EEFBE8F
select hex(@utf84:= CONVERT(@ujis4 USING utf8));
hex(@utf84:= CONVERT(@ujis4 USING utf8))
EFBE90EFBE91EFBE92EFBE93EFBE94EFBE95EFBE96EFBE97EFBE98EFBE99EFBE9AEFBE9BEFBE9CEFBE9DEFBE9EEFBE9F
select @ujis1 = CONVERT(@utf81 USING ujis);
@ujis1 = CONVERT(@utf81 USING ujis)
1
select @ujis2 = CONVERT(@utf82 USING ujis);
@ujis2 = CONVERT(@utf82 USING ujis)
1
select @ujis3 = CONVERT(@utf83 USING ujis);
@ujis3 = CONVERT(@utf83 USING ujis)
1
select @ujis4 = CONVERT(@utf84 USING ujis);
@ujis4 = CONVERT(@utf84 USING ujis)
1
......@@ -41,3 +41,23 @@ select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate uji
select 'a' like 'a';
select 'A' like 'a';
select 'A' like 'a' collate ujis_bin;
#
# Bug 3290: Hald-width Katakana conversion problem.
# Check ujis-utf8-ujis round trip.
#
set @ujis1= _ujis 0x8EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAB8EAC8EAD8EAE8EAF;
set @ujis2= _ujis 0x8EB08EB18EB28EB38EB48EB58EB68EB78EB88EB98EBA8EBB8EBC8EBD8EBE8EBF;
set @ujis3= _ujis 0x8EC08EC18EC28EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECE8ECF;
set @ujis4= _ujis 0x8ED08ED18ED28ED38ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF;
select hex(@utf81:= CONVERT(@ujis1 USING utf8));
select hex(@utf82:= CONVERT(@ujis2 USING utf8));
select hex(@utf83:= CONVERT(@ujis3 USING utf8));
select hex(@utf84:= CONVERT(@ujis4 USING utf8));
select @ujis1 = CONVERT(@utf81 USING ujis);
select @ujis2 = CONVERT(@utf82 USING ujis);
select @ujis3 = CONVERT(@utf83 USING ujis);
select @ujis4 = CONVERT(@utf84 USING ujis);
......@@ -8342,18 +8342,14 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e)
static int
my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
{
unsigned char buf[2];
unsigned char c1;
int ret,jp;
int jp;
if (s >= e)
return MY_CS_TOOSMALL;
if ((int) wc < 0x80)
{
if (s>e)
return MY_CS_TOOSMALL;
*s= (uchar) wc;
return 1;
}
......@@ -8369,21 +8365,20 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
return 2;
}
ret=my_wc_mb_jisx0201(c,wc,buf,buf+2);
if (ret==1)
/* Half width Katakana */
if (my_wc_mb_jisx0201(c,wc,s,e) == 1)
{
if (s+1>e)
if (s+2>e)
return MY_CS_TOOSMALL;
s[0]=0x8E;
s[1]=buf[0];
return 1;
s[1]= s[0];
s[0]= 0x8E;
return 2;
}
if ((jp=my_uni_jisx0212_onechar(wc)))
{
if (s+2>e)
if (s+3>e)
return MY_CS_TOOSMALL;
jp+=0x8080;
......
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