Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

Tagged: 

This topic contains 2 replies, has 0 voices.

Last updated by yannA-5 1 day, 23 hours 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,