Broshi
Broshi

Reputation: 3592

WordPress Emojis are gone after database migration

I have migrated my db and some emojis are now missing:

https://i.sstatic.net/TDQnQ.png

on the dump .sql file I can see the emoji, but during the import process something is destroying some of the emojis, i've used this script to import:

https://korobochkin.wordpress.com/2017/02/25/import-and-export-wordpress-database-with-utf8mb4-charset/

Any ideas?

Upvotes: 2

Views: 1788

Answers (1)

DeepSpace101
DeepSpace101

Reputation: 13722

This is an older question but answering for future readers. UTF8 is simple and universal on other platforms but MySQL has half-baked support for utf8 making it unnecessarily complex. In MySQL, utf8 is actually utf8mb4 and not utf8 (!!). Between that weirdness and WordPress's own utf8 vs utf8mb4 support, there are several things to look into.

  1. Check your wp-config.php if it’s got define('DB_CHARSET', 'utf8mb4'); Several backup scripts use this when deciding what character set to import to post-export.

  2. Do a text search in your migration/backup SQL script for SET NAMES utf8. It would be as an executable comment like /*!40101 SET NAMES utf8 */;. Either ways, change utf8 there to utf8mb4 and retry the migration

  3. Open your backup/migration SQL script and check the the CREATE TABLEs have the correct CHARSET=utf8mb4 in them.

  4. Finally, open the .SQL script in a real texteditor like notepad++ or VS Code and do a text search to see if the emoji exists in the backup itself. For example: if you have "Our platform is fast πŸš€" somewhere in your original WordPress page, search for "Our platform is fast" in the SQL backup and see if your have ???? or πŸš€ in the .sql file just after that.

Beyond that, it's time to look into your MySQL setup, see this question/answer

Upvotes: 3

Related Questions