Skip to content Skip to sidebar

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

Problem:
The client is experiencing an issue where special characters like the en dash (–) are being replaced by a regular hyphen (-) in translations using WPML. This alteration occurs regardless of the translation method used, affecting the intended formatting of product titles and descriptions.

Solution:
We conducted detailed tests using both automatic and manual translations across different language pairs and translation services. Here are the findings:
1. When using PTC for translations, the issue does not occur. The en dash remains unchanged in both the Advanced Translation Editor (ATE) and on the frontend.
2. When using DeepL, the en dash is replaced by a regular hyphen in the ATE, but it displays correctly as an en dash on the frontend. This inconsistency is due to DeepL's internal grammar rules, which we cannot alter.

If this solution does not resolve your issue or seems outdated, we recommend opening a new support ticket. Additionally, please check the related known issues, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. For further assistance, visit our support forum.

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.

This topic contains 9 replies, has 0 voices.

Last updated by Waqas Bin Hasan 1 month, 1 week ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 3, 2025 at 6:08 pm #17291171

yannA-5

Background of the issue:
I am trying to translate product titles and descriptions using WPML, while keeping special characters like the en dash (–) unchanged. You can see the issue on this page: hidden link.

Symptoms:
The en dash (–, Unicode U+2013) is automatically replaced by a regular hyphen (-, ASCII 0x2D) in the translated content, which alters the intended formatting.

Questions:
How can I prevent WPML from altering specific characters like the en dash during translation?

August 5, 2025 at 9:50 am #17295891

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the WPML support.

Can you please try these steps?

1- Get access to your website files.
2- Go to \WPML_Super_Globals_Validation::get_value in wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/class-wpml-super-globals-validation.php
3- change the following code:

			} else {
				$value = filter_var( $var[ $key ], $filter );
			}

4- with:

			} else {
				$value = filter_var( $var[ $key ], FILTER_SANITIZE_STRING  );
			}

5- save the file.

Note: Before doing these changes please be sure to make a full backup(files & database) of your website in order to avoid any data loss.

Let me know if this works out or if you need any further help.

Regards.

August 8, 2025 at 6:38 pm #17306163

yannA-5

Hi,
Thank you for your reply and for providing the suggested code modification.
Unfortunately, after applying the change as instructed, the issue still persists: the en dash character (–) is still being replaced by a regular hyphen (-) in the translated content.

Could you please advise on the next steps or provide an alternative solution to ensure that the en dash (–, Unicode U+2013) is preserved exactly as in the source text during translation?

I can provide additional examples or screenshots if needed.
Best regards,

August 11, 2025 at 6:24 am #17308119

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates.

Yes please it'd be great if you can provide a few examples and the screenshots. So I can try accordingly and get back to you with more information.

August 15, 2025 at 5:23 pm #17324077

yannA-5

Hi Waqas,
Please see the attached image.
Regards

WPML_keeping_special_characters.jpg
August 18, 2025 at 5:59 am #17326101

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates.

Can you please try using WPML Glossary and see it if helps in this case?

August 21, 2025 at 7:36 pm #17338867

yannA-5

Hi Waqas,
Thank you for your advice.
It doesn't work with the glossary either!
Let me know.
Regards

August 22, 2025 at 4:53 am #17339355

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates, I am working on this and 'll get back to you as soon as I find something or have a solution.

August 22, 2025 at 6:33 am #17339443

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I tested this in very much detail using automatic translation, as well as, manual but auto-translated within the ATE. I also tested from English (default) to French and Italian (secondary), as well as, French (default) to English & Italian (secondary).

Further I tested using DeepL default formality and formal/informal formalities, as well as, with PTC auto-formality. Here are my findings:

- Using PTC: Issue doesn't happen at all. After translating if you open the translation in ATE, you can see the same – in the translation too.

- Using DeepL: Regardless of the formality, you can see - instead of – in the translation. However, this does not affect the translation on frontend. For example, if you check this Italian translation hidden link and then check the translation in ATE, you'll notice that – works fine on frontend, although ATE shows - in the translation.

You can use this sandbox site (hidden link - one click login) and try it. This setup is using minimal setup (i.e. WPML, String Translation and a default WordPress theme).

August 22, 2025 at 7:47 am #17339575

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Just an update as I also discussed with our team:

...this is a known issue. some special characters are changed because DeepL thinks it's needed. it's supposed to be a grammar thing, that's supposed to be the correct translation.

that can't be fixed because it comes from deepl (we've tried asking many times already).