diff options
author | unknown <bar@mysql.com> | 2004-09-09 18:21:31 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2004-09-09 18:21:31 +0500 |
commit | cc12a462d626bf56e0f979f71dd6369a27bbbedd (patch) | |
tree | b09e1a7401e4d1a9e95bc9c66be1fa26cab441f2 /strings | |
parent | 1ba3a1709985b883e6172edcba96b4b60e94c031 (diff) | |
download | mariadb-git-cc12a462d626bf56e0f979f71dd6369a27bbbedd.tar.gz |
Bug #3453 MySQL output formatting in multibyte character sets
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-big5.c | 2 | ||||
-rw-r--r-- | strings/ctype-euc_kr.c | 2 | ||||
-rw-r--r-- | strings/ctype-gb2312.c | 2 | ||||
-rw-r--r-- | strings/ctype-gbk.c | 2 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 32 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 36 |
6 files changed, 70 insertions, 6 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 3f35f7504ac..a7226c10ce3 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -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, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 43a50b0dfbe..0bf9a5210ea 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -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, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index 8d97ac9ca1d..726f9fd464c 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -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, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 9400fb08f2b..8a7df87c024 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -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, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index b4cfee0f24a..8ed2e9d9c0b 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -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, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 37c26a3bbc4..514f28275ca 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -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, |