diff options
author | Alexander Barkov <bar@mysql.com> | 2010-03-11 14:34:11 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2010-03-11 14:34:11 +0400 |
commit | a388efbffab83e34d3006883dcd1d29b2128545c (patch) | |
tree | bf2cc43cccc940c1a6702ba10b12897c9504ba79 /strings | |
parent | 99d1b2bd9a8a05d5adc7985bc082456296d2d2b5 (diff) | |
download | mariadb-git-a388efbffab83e34d3006883dcd1d29b2128545c.tar.gz |
An additional fix for WL#1213 4-byte UTF8
- Fixing crash on attempt to create a fulltext index with an utf8mb4 column
- fixing wrong border width for supplementary characters in mysql client:
mysql --default-character-set=utf8mb4 -e "select concat(_utf32 0x20000,'a')"
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-mb.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 98b598c3c2c..b1b381da59e 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -1123,8 +1123,16 @@ size_t my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) continue; } b+= mb_len; - pg= (wc >> 8) & 0xFF; - clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; + if (wc > 0xFFFF) + { + if (wc >= 0x20000 && wc <= 0x3FFFD) /* CJK Ideograph Extension B, C */ + clen+= 1; + } + else + { + pg= (wc >> 8) & 0xFF; + clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; + } clen++; } return clen; @@ -1136,7 +1144,7 @@ int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype, { my_wc_t wc; int res= cs->cset->mb_wc(cs, &wc, s, e); - if (res <= 0) + if (res <= 0 || wc > 0xFFFF) *ctype= 0; else *ctype= my_uni_ctype[wc>>8].ctype ? |