Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client was unable to save theme string translations in WPML due to a WordPress database error. The error was triggered by an emoji in the string, causing the query to contain invalid data.
Solution:
We identified that the issue might be related to unsupported character encoding or misconfigured database collation. To resolve this, we recommended:
1. Checking the database's character encoding to ensure it supports emojis and special characters. WordPress uses

utf8mb4

encoding.
2. Using a database management tool like phpMyAdmin to verify and adjust the collation of the affected table to either

utf8mb4_unicode_ci

or

utf8mb4_general_ci

.
3. If the issue persists, consider reaching out to the hosting provider for further assistance or installing a database management plugin on a sandbox site to compare collations.

Please note that this solution might be outdated or not applicable to your specific case. If the problem persists, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, do not hesitate to open a new support ticket with us for further assistance.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 0 reply, has 1 voice.

Last updated by Julien SEIXAS 7 months, 2 weeks ago.

Assisted by: Bobby.

Author Posts
November 20, 2024 at 9:23 pm #16426551

Julien SEIXAS

Background of the issue:
I am trying to save theme string translations using WPML. The issue can be seen at the following URL: hidden link

Symptoms:
I expected to see a success notice indicating that all my imported strings are saved. Instead, I received a WordPress database error stating that the query cannot be performed because it contains invalid data. The error details include an array with language, context, domain name context MD5, name, value, status, translation priority, and allow empty value.

```
WordPress database error: the query cannot be performed because it contains invalid data.
Array
(
[language] => en
[context] => example-com
[gettext_context] =>
[domain_name_context_md5] => 2d33d2701c8fc778cbe7b7babc081044
[name] => 8245870efde76f00c60626eaa4e2b600
[value] => Argentine 🇦🇷
[status] => 0
[translation_priority] => optional
[allow_empty_value] =>
)
```

Questions:
Why am I receiving a WordPress database error when saving string translations?
How can I resolve the issue with invalid data in the query?

November 20, 2024 at 10:58 pm #16426702

Julien SEIXAS

After discussion in the live chat, the problem seems to be in my environment. Are there any prerequisites or recommendations regarding my database configuration or the rights required on certain files for this functionality?
I'd like to start translating the strings again from scratch, but I can't even delete them from the interface. The action has no effect

November 21, 2024 at 8:16 am #16427808

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi,

The issue you are experiencing could indicate:

1. Unsupported character encoding (e.g., the emoji 🇦🇷 might not be stored correctly in the database).

2. Misconfigured database collation

You are welcome to install the plugin phpmyadmin or adminer on the sandbox website to compare the collations between that database and yours.

Or possibly reach out to the hosting provider and ask them to do a check from their side.

WordPress uses utf8mb4 encoding to support emojis and special characters.
Access your database using phpMyAdmin or a similar tool and check the collation of the affected table:
Ensure that the collation is set to utf8mb4_unicode_ci or utf8mb4_general_ci.

November 21, 2024 at 2:43 pm #16429710

Julien SEIXAS

Hi bobby,

Since I cannot have time to debug that, I had simply removed all emojis, delete all strings, recreate my translations files and load them again.

Now it seems working.

Thank you so much for your help