1

Before, using MariaDB 10.5 and mysqli, I had plenty of old WordPress website on utf8mb3 tables where I can successfully save a wide range of Emojis in the database.

Now since I switched to MariaDB 10.6 and nd_mysqli, if the database and tables are not converted to utf8mb4, WordPress cannot save anymore the old post that already contain emojis…

It's time consuming to troubleshoot it for WordPress users as this happen without any notice in the Apache error_log or WordPress debug.log. No explicit error is showed by WordPress in Classic Editor: the edit post form is just refreshing and the content is lost. Or in the Block Editor, the error is "Updating failed. Error message : Could not update post in the database" and/or an Error 500 can be showed in the browser Console, with no logs in the server.

The most frustrating for the users is that, old WordPress websites, with old tables in utf8mb3, before successfully stored emojis in old content… and then, overnight (after the server update), the same old WordPress website cannot save content with emojis anymore.

I have tried to change the MariaDB old_mode which is supposed to be empty, like this in the my.cnf :

old_mode=""

From MariaDB 10.6, utf8 is by default an alias for utf8mb3, but I guess this can be changed to ut8mb4 by changing the default value of the old_mode system variable by an empty value (more info about utf8 alias in the MariaDB unicode doc).

But it does not work… emojis still don't save in utf8mb3 tables as it works before.

• I can understand that utf8mb3 do not suit for emojis.

But…

• I cannot understand why so much old WordPress websites created in the past with utf8mb3 tables have old content with plenty emojis stored inside, that are displaying properly in the frontend and backend without being replaced by a ??? sign.

Just saving is now impossible now.

What is this new behaviour?

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

Consider migrating your tables to UTF-8 by converting them to use utf8mb4 charset. The old 3 byte charset is deprecated and should not be used.

PHP (mysqlnd) does not support utf8mb3. You cannot use this charset yet. If you can't convert your tables then use the alias for utf8mb3: utf8.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • That's the issue. I can't convert all the tables manually, because I have several servers that host around a thousand websites each. Yes ! I would like to alias utf8mb3 to utf8mb4, but I don't know how to proceed. Any help ? (the MariaDB doc is not so clear about it) I have tried to change the MariaDB my.cnf : [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] character-set-server=utf8mb4 character-set-server=utf8mb4 collation-server=utf8mb4_general_ci old_mode="" It's suppose to use utf8mb4 then ? But for new database I am afraid. – Nicolas Laruelle - EasyHoster Mar 23 '23 at 01:31
  • Just use `$mysqli->set_charset('utf8')` or however WP allows you to set this configuration. – Dharman Mar 23 '23 at 08:48
  • Thank you Dharman! But again, it not help for the global infrastructure as each WordPress wp-config files cannot be changed individually for all end-users (hundreds and hundreds users). Thank you anyway for your precious feedback! Appreciate. – Nicolas Laruelle - EasyHoster Mar 24 '23 at 01:57