1 year ago

Incorrect string value

Posted 1 year ago by eriktobben


I have upgraded a Laravel 5.1 project to 5.7 and moved it to a server with PHP 7.2 and MariaDB 10.2.18.

In the old version I was using MySQL 5.5.62 and was having problems if the message that should be stored contained an emoji. The text after the emoji was not stored in the database, but no error was thrown.

After upgrading I exported the database and imported it on the new server and I though the problem was fixed.

Today, I got the following error: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\x91\x8D\xF0\x9F...' for column 'message' at row 1.

Here are info about the new database: Type: InnoDB Encoding: UTF-8 Unicode (utf8) Collation: utf8_unicode_ci

Is there something I can change here in the database so it can store emojis? And can I change this on a live database? (After taking backup of course).

Please sign in or create an account to participate in this conversation.