mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
bug#10344: some string function fail for UCS2
substr fix
This commit is contained in:
parent
b580a12d47
commit
8a5c6502ca
3 changed files with 29 additions and 1 deletions
|
@ -598,6 +598,24 @@ ucs2_bin 00610009
|
|||
ucs2_bin 0061
|
||||
ucs2_bin 00610020
|
||||
drop table t1;
|
||||
select hex(substr(_ucs2 0x00e400e50068,1));
|
||||
hex(substr(_ucs2 0x00e400e50068,1))
|
||||
00E400E50068
|
||||
select hex(substr(_ucs2 0x00e400e50068,2));
|
||||
hex(substr(_ucs2 0x00e400e50068,2))
|
||||
00E50068
|
||||
select hex(substr(_ucs2 0x00e400e50068,3));
|
||||
hex(substr(_ucs2 0x00e400e50068,3))
|
||||
0068
|
||||
select hex(substr(_ucs2 0x00e400e50068,-1));
|
||||
hex(substr(_ucs2 0x00e400e50068,-1))
|
||||
0068
|
||||
select hex(substr(_ucs2 0x00e400e50068,-2));
|
||||
hex(substr(_ucs2 0x00e400e50068,-2))
|
||||
00E50068
|
||||
select hex(substr(_ucs2 0x00e400e50068,-3));
|
||||
hex(substr(_ucs2 0x00e400e50068,-3))
|
||||
00E400E50068
|
||||
SET NAMES latin1;
|
||||
SET collation_connection='ucs2_swedish_ci';
|
||||
CREATE TABLE t1 (Field1 int(10) default '0');
|
||||
|
|
|
@ -374,6 +374,16 @@ SET NAMES latin1;
|
|||
SET collation_connection='ucs2_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
|
||||
#
|
||||
# Bug#10344 Some string functions fail for UCS2
|
||||
#
|
||||
select hex(substr(_ucs2 0x00e400e50068,1));
|
||||
select hex(substr(_ucs2 0x00e400e50068,2));
|
||||
select hex(substr(_ucs2 0x00e400e50068,3));
|
||||
select hex(substr(_ucs2 0x00e400e50068,-1));
|
||||
select hex(substr(_ucs2 0x00e400e50068,-2));
|
||||
select hex(substr(_ucs2 0x00e400e50068,-3));
|
||||
|
||||
SET NAMES latin1;
|
||||
#
|
||||
# Bug#8235
|
||||
|
|
|
@ -1261,7 +1261,7 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||
const char *e __attribute__((unused)),
|
||||
uint pos)
|
||||
{
|
||||
return pos*2;
|
||||
return pos > e - b ? e - b + 2 : pos * 2;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue