Skip Navigation

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-08:00)

Tagged: 

This topic contains 6 replies, has 3 voices.

Last updated by Bobby 5 months ago.

Assisted by: Bobby.

Author Posts
June 20, 2024 at 2:26 pm #15764583

dominikM-32

Background of the issue:
Hi, I've problem. I can't translate products because they have base64 encoded descriptions. The site I need help with is hidden link. The text on the page says that WPML cannot send part of the content for translation because it contains fields that are encoded. Translators will not be able to work with this kind of content, so it has been removed from the job. To solve this problem, I need to inform WPML how these fields are encoded so that WPML can decode them before sending them for translation.

Symptoms:
WPML nie może przesłać części zawartości do tłumaczenia. Część zawartości, którą wybrano do tłumaczenia zawiera pola, które są kodowane. Tłumacze nie będą w stanie pracować z tego rodzaju zawartością, a zatem usunęliśmy ją ze zlecenia.

Questions:
Any ideas on how to change or dismiss base64 encoded descriptions?
Jak wskazać WPML, że ma dekodować pola?

June 20, 2024 at 10:25 pm #15767948

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hi,

Welcome to the WPML support forum. Thanks for contacting us.

While waiting for one of my colleagues to help with this ticket, I had asimilar case this week where the issue was coming from custom fields from a previous theme.

Here is the ticket: https://wpml.org/fr/forums/topic/https-hoo-talk-com/
- Go to "WPML > Settings > Custom fields translation"
- Check the box "Show "Multilingual Content Setup" meta box on post edit screen."
- Go back to edit the original page in the WordPress editor.
- At the bottom you will have a new section that will show you all custom fields used on that page and review those custom fields.

Please also provide us with your debug information. This information is crucial for us to understand better your configuration: https://wpml.org/faq/provide-debug-information-faster-support/

In short:
- Go to "WPML > Support > Debug Information" (link)
- Copy the Debug Information from there.
- Find the private field I activated and paste that information.

Looking forward to hearing back from you.

Nico

June 20, 2024 at 10:42 pm #15768076

Bobby
Supporter

Languages: English (English )

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

Hi there,

There is a hyperlink next to each item, what are your results after clicking it? Can you please share it with me?

June 21, 2024 at 8:49 am #15772662

dominikM-32

Hello there! Hi Nicolas.
It is not it.
The problem is the names of images that are saved in WP as base64 binary code. Is it possible to exclude the translation of image descriptions and names, or make WPML not translate this type of data?

There is also an option at the bottom of the settings - Media translation. But when I deselect it, it remains selected anyway. Maybe there's a way around it...

June 21, 2024 at 10:13 pm #15779241

Bobby
Supporter

Languages: English (English )

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

Hi there,

Just to verify are all the listed items names from images?

I have had a similar case in the past where this was triggered due to the complex names of pdf file names.

Please try this workaround:

edit wp-content/plugins/sitepress-multilingual-cms/classes/utilities/class-wpml-encoding-validation.php and replace is_base64 function with

public function is_base64( $string ) {
    return false;
}

NOTE: Always have a recent and working backup before making any changes recommended by our team or a 3rd party

June 24, 2024 at 10:33 am #15805645

dominikM-32

Thank You.
Is this what it's supposed to look like?

<?php

use WPML\FP\Str;

class WPML_Encoding_Validation {

const MINIMUM_STRING_LENGTH = 100;

/**
* Checks if data passed is base64 encoded string and if the length of it is more than or equal to $minimumValidStringLength.
* Here we check for the length because we had cases were featured image names are passed in a false positive base64 encoding format.,
* and this made the whole job to be blocked from sending to translation, while if a real field is encoded the length of it should be way more than how the image name will be.
*
* @param string $string
*
* @see hidden link
* @see hidden link
*/
/**
* public function is_base64_with_100_chars_or_more( $string ) {
if ( (bool) preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string ) === false ) {
return false;
}

$decoded = base64_decode( $string, true );
if ( $decoded === false ) {
return false;
}

$encoding = mb_detect_encoding( $decoded );
if ( ! in_array( $encoding, [ 'UTF-8', 'ASCII' ], true ) ) {
return false;
}

return $decoded !== false && base64_encode( $decoded ) === $string && Str::len( $string ) >= self::MINIMUM_STRING_LENGTH;
}
*/
public function is_base64( $string ) {
return false;
}
}

June 24, 2024 at 8:35 pm #15811354

Bobby
Supporter

Languages: English (English )

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

That looks OK from what I can see based on the above info, did it work ok and are you still seeing the errors.

The topic ‘[Closed] Base64 problem’ is closed to new replies.