[MDEV-7677] my_charset_handler_filename has a wrong "ismbchar" member Created: 2015-03-06  Updated: 2015-03-23  Resolved: 2015-03-23

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.1
Fix Version/s: 10.1.4

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

In this definition in ctype-utf8.c:

static MY_CHARSET_HANDLER my_charset_filename_handler=
{
    NULL,               /* init */
    my_ismbchar_utf8,
    my_mbcharlen_utf8,  /* TODO: this is wrong */
    ...
};

using utf8 functions for "filename" looks wrong.
It must have its own functions.
This bug is about ismbchar() which has a simple repeatable SQL script.
The problem with mbcharlen() is reported separately in MDEV-7819.

Prove:

SET NAMES utf8;
SELECT @a:=CONVERT('aя' USING filename) AS `@a`, binary @a, reverse(@a), hex(@a), hex(reverse(@a));

returns:

+-----+-----------+-------------+----------+------------------+
| @a  | binary @a | reverse(@a) | hex(@a)  | hex(reverse(@a)) |
+-----+-----------+-------------+----------+------------------+
| aя  | a@r1      | 1r?a        | 61407231 | 31724061         |
+-----+-----------+-------------+----------+------------------+

This is wrong. The expected result should be:
'яa' for `reverse(@a)`
'40723161' for `hex(reverse(@a))`.


Generated at Thu Feb 08 07:21:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.