summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-07-14 12:00:05 +0400
committerAlexander Barkov <bar@mariadb.org>2015-07-14 12:00:05 +0400
commit75931feabe99595e9659a423e299c4229d3c02ba (patch)
tree2741b4bcc3ce47698a336c141bb551ded585c5d6 /strings
parent657f8a8d600a5ae9cd8026286073fd479c2adec7 (diff)
downloadmariadb-git-75931feabe99595e9659a423e299c4229d3c02ba.tar.gz
MDEV-8362 dash '-' is not recognized in charset armscii8 on select where query
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-simple.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index d7a1b3f33b4..394924c8209 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1303,7 +1303,28 @@ create_fromuni(struct charset_info_st *cs,
if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc)
{
int ofs= wc - idx[i].uidx.from;
- tab[ofs]= ch;
+ if (!tab[ofs] || tab[ofs] > 0x7F) /* Prefer ASCII*/
+ {
+ /*
+ Some character sets can have double encoding. For example,
+ in ARMSCII8, the following characters are encoded twice:
+
+ Encoding#1 Encoding#2 Unicode Character Name
+ ---------- ---------- ------- --------------
+ 0x27 0xFF U+0027 APOSTROPHE
+ 0x28 0xA5 U+0028 LEFT PARENTHESIS
+ 0x29 0xA4 U+0029 RIGHT PARENTHESIS
+ 0x2C 0xAB U+002C COMMA
+ 0x2D 0xAC U+002D HYPHEN-MINUS
+ 0x2E 0xA9 U+002E FULL STOP
+
+ That is, both 0x27 and 0xFF convert to Unicode U+0027.
+ When converting back from Unicode to ARMSCII,
+ we prefer the ASCII range, that is we want U+0027
+ to convert to 0x27 rather than to 0xFF.
+ */
+ tab[ofs]= ch;
+ }
}
}
}