summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-12-10 16:08:18 +0400
committerunknown <bar@mysql.com>2004-12-10 16:08:18 +0400
commit05cb2737b93ab4c8509ca78126883e6c850aa218 (patch)
tree3a037f5200b0a2e6823546ba0d5ba0323ac43b69 /strings
parent95056a0b657b6d4f3a9106e4f21dfdf348da3690 (diff)
downloadmariadb-git-05cb2737b93ab4c8509ca78126883e6c850aa218.tar.gz
Bug #6819 Some ujis characters cannot be inserted into table
Allow to insert not-assigned UJIS codes.
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-ujis.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 94673a20795..fc1496df280 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8243,7 +8243,6 @@ my_jisx0212_uni_onechar(int code){
}
-
/*
EUC-JP encoding subcomponents:
[x00-x7F] # ASCII/JIS-Roman (one-byte/character)
@@ -8253,6 +8252,47 @@ my_jisx0212_uni_onechar(int code){
*/
static
+uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)),
+ const char *beg, const char *end, uint pos)
+{
+ const uchar *b= (uchar *) beg;
+
+ for ( ; pos && b < (uchar*) end; pos--, b++)
+ {
+ char *chbeg;
+ uint ch= *b;
+
+ if (ch <= 0x7F) /* one byte */
+ continue;
+
+ chbeg= (char *) b++;
+ if (b >= (uchar *) end) /* need more bytes */
+ return chbeg - beg; /* unexpected EOL */
+
+ if (ch == 0x8E) /* [x8E][xA0-xDF] */
+ {
+ if (*b >= 0xA0 && *b <= 0xDF)
+ continue;
+ return chbeg - beg; /* invalid sequence */
+ }
+
+ if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */
+ {
+ ch= *b++;
+ if (b >= (uchar*) end)
+ return chbeg - beg; /* unexpected EOL */
+ }
+
+ if (ch >= 0xA1 && ch <= 0xFE &&
+ *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */
+ continue;
+ return chbeg - beg; /* invalid sequence */
+ }
+ return b - (uchar *) beg;
+}
+
+
+static
uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)),
const char *str, const char *strend)
{
@@ -8475,7 +8515,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_ujis,
my_numchars_mb,
my_charpos_mb,
- my_well_formed_len_mb,
+ my_well_formed_len_ujis,
my_lengthsp_8bit,
my_numcells_eucjp,
my_mb_wc_euc_jp, /* mb_wc */