MariaDB unicode text got truncated
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?