Fix: Illegal mix of collations in TranslatePress

I was working on a WordPress project with TranslatePress installed. The site had multilingual content including German, French and English — and some pages contained emojis and special characters.

Suddenly TranslatePress stopped translating automatically. Checking the logs I found the following error repeating itself:

Illegal mix of collations for operation 'in'
Error running get_untranslated_strings()

The query TranslatePress was running internally hit a collation mismatch — the original column in the TranslatePress dictionary table was using utf8, but the incoming strings contained utf8mb4 characters like emojis (☎️, ????). MySQL simply couldn’t compare them.

Workaround:

Open your wp-config.php and check or add the following two lines:

define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', 'utf8mb4_unicode_ci');
  • DB_CHARSET — tells WordPress to use utf8mb4 encoding for the database connection
  • DB_COLLATE — sets the collation to utf8mb4_unicode_ci, which supports the full Unicode range including emojis

After saving the file, TranslatePress was working again immediately — no restart required.

If the error persists after this change, the TranslatePress dictionary table itself may need to be converted:

ALTER TABLE `wp_trp_dictionary_de_ch_en_us`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Replace the table name with your actual table name — it varies depending on your language pair configuration.

Root cause:

WordPress historically used utf8 which only supports 3-byte Unicode. Emojis and some special characters require 4-byte encoding (utf8mb4). If your wp-config.php was set up before utf8mb4 became standard, this mismatch will eventually surface once your content contains such characters.

No votes yet.
Please wait...

Leave a Reply

Your email address will not be published. Required fields are marked *