Bug #3453 MySQL output formatting in multibyte character sets

This commit is contained in:
unknown 2004-09-09 18:21:31 +05:00
parent 1ba3a17099
commit cc12a462d6
6 changed files with 70 additions and 6 deletions

View file

@ -6290,7 +6290,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_numcells_mb,
my_numcells_8bit,
my_mb_wc_big5, /* mb_wc */
my_wc_mb_big5, /* wc_mb */
my_caseup_str_mb,

View file

@ -8657,7 +8657,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_numcells_mb,
my_numcells_8bit,
my_mb_wc_euc_kr, /* mb_wc */
my_wc_mb_euc_kr, /* wc_mb */
my_caseup_str_mb,

View file

@ -5708,7 +5708,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_numcells_mb,
my_numcells_8bit,
my_mb_wc_gb2312, /* mb_wc */
my_wc_mb_gb2312, /* wc_mb */
my_caseup_str_mb,

View file

@ -9939,7 +9939,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_numcells_mb,
my_numcells_8bit,
my_mb_wc_gbk,
my_wc_mb_gbk,
my_caseup_str_mb,

View file

@ -4534,6 +4534,36 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static
uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)),
const char *str, const char *strend)
{
uint clen= 0;
const unsigned char *b= (const unsigned char *) str;
const unsigned char *e= (const unsigned char *) strend;
for (clen= 0; b < e; )
{
if (*b >= 0xA1 && *b <= 0xDF)
{
clen++;
b++;
}
else if (*b > 0x7F)
{
clen+= 2;
b+= 2;
}
else
{
clen++;
b++;
}
}
return clen;
}
static MY_COLLATION_HANDLER my_collation_ci_handler =
{
@ -4558,7 +4588,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_numcells_mb,
my_numcells_sjis,
my_mb_wc_sjis, /* mb_wc */
my_wc_mb_sjis, /* wc_mb */
my_caseup_str_8bit,

View file

@ -8252,6 +8252,40 @@ my_jisx0212_uni_onechar(int code){
[xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char)
*/
static
uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)),
const char *str, const char *strend)
{
uint clen= 0;
const unsigned char *b= (const unsigned char *) str;
const unsigned char *e= (const unsigned char *) strend;
for (clen= 0; b < e; )
{
if (*b == 0x8E)
{
clen++;
b+= 2;
}
else if (*b == 0x8F)
{
clen+= 2;
b+= 3;
}
else if (*b & 0x80)
{
clen+= 2;
b+= 2;
}
else
{
clen++;
b++;
}
}
return clen;
}
static int
my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e)
{
@ -8443,7 +8477,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_charpos_mb,
my_well_formed_len_mb,
my_lengthsp_8bit,
my_numcells_mb,
my_numcells_eucjp,
my_mb_wc_euc_jp, /* mb_wc */
my_wc_mb_euc_jp, /* wc_mb */
my_caseup_str_mb,