MariaDB unicode text got truncated I'm using 5.5.40-MariaDB in Centos 7.

[root@test ~]# /usr/libexec/mysqld -V
/usr/libexec/mysqld  Ver 5.5.40-MariaDB for Linux on x86_64 (MariaDB Server)


I'm trying to insert a unicode string into TEXT column like:

Perl:

my $sth = $dbh-&gt;prepare("REPLACE INTO Test (`Val`) VALUES (?)");
$sth-&gt;execute( uri_unescape('%D7%9E%D7%95%D7%A6%D7%A8%D7%99%D7%9D/%D7%94%D7%A1%D7%A7%D7%94-%D7%9E%D7%A8%D7%9B%D7%96%D7%99%D7%AA/%D7%A4%D7%9C%D7%98/328-%D7%9E%D7%90%D7%91%D7%99%D7%A1-%D7%A4%D7%9C%D7%98-%D7%9C%D7%91%D7%95%D7%99%D7%9C%D7%A8-%D7%97%D7%99%D7%') . ' -- A' );


Php:

$sth = $dbh-&gt;prepare("REPLACE INTO Test (`Val`) VALUES (?)");
$sth-&gt;execute( array(urldecode('%D7%9E%D7%95%D7%A6%D7%A8%D7%99%D7%9D/%D7%94%D7%A1%D7%A7%D7%94-%D7%9E%D7%A8%D7%9B%D7%96%D7%99%D7%AA/%D7%A4%D7%9C%D7%98/328-%D7%9E%D7%90%D7%91%D7%99%D7%A1-%D7%A4%D7%9C%D7%98-%D7%9C%D7%91%D7%95%D7%99%D7%9C%D7%A8-%D7%97%D7%99%D7%') . ' -- A') );


Then in MySQL, it is:

+-----------------------------------------------------------------------------------------------------------------+
| Val                                                                                                             |
+-----------------------------------------------------------------------------------------------------------------+
| מוצרים/הסקה-מרכזית/פלט/328-מאביס-פלט-לבוילר-חי                                    |
+-----------------------------------------------------------------------------------------------------------------+


The ' -- A' is not inserted at all. (both Perl and PHP have the same result so it should be a bug in MySQL itself?)

If I remove the last '%D7%' in url, then it will be inserted as

+----------------------------------------------------------------------------------------------------------------------+
| Val                                                                                                                  |
+----------------------------------------------------------------------------------------------------------------------+
| מוצרים/הסקה-מרכזית/פלט/328-מאביס-פלט-לבוילר-חי -- A                                    |
+----------------------------------------------------------------------------------------------------------------------+


So is there any magic for %D7% (or just %D7)? how to fix that in MySQL? any my.cnf settings?

Table defined as:

CREATE TABLE `Test` (
  `Val` mediumtext COLLATE utf8_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
When inserting utf8 strings, an invalid byte combination will cause truncation.

You have two different functions; I assume one blindly left a D7 at then end, leading to truncation; and the other stripped it off?