• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Woody Snippet character transformation during export/import

SantiAD

New member
Messages
3
Likes
0
Points
1
#1
Hi,

I am performing a migration between two different Wordpress installation and I have a problem after the import in the new site.

The problem is that after the import, all the PHP snippets have some errors caused by a bad translation of some characters. Here is an example:

  • Origin WP site: echo "<li style=\"text-align: justify;\"><strong><a rel= \"nofollow\" href=\"".$deeplink_web."\" target=\"_blank\">".$title."</strong></a> el ".$date."</li>";
  • JSON file exported: echo \"<li style=\\\"text-align: justify;\\\"><strong><a rel= \\\"nofollow\\\" href=\\\"\".$deeplink_web.\"\\\" target=\\\"_blank\\\">\".$title.\"<\/strong><\/a> el \".$date.\"<\/li>;
  • Destination WP site: echo "<li style="text-align: justify;"><strong><a rel= "nofollow" href="".$deeplink_web."" target="_blank">".$title."</strong></a> el ".$date."</li>;

During the export function the character \" is translate to \\\" and it causes a failure in Dest. WP site.

So, is it any way to fix this problem or avoid this character translation?

Thanks for the help. Regards.
Santi
 

Temyk

Developer & Support
Staff member
Messages
704
Likes
32
Points
28
#2
Hello.

When exporting and importing, we use standard PHP functions: json_encode and json_decode. They work like this.

I can advise you to use single quotes inside double quotes.
PHP:
echo "<li style='text-align: justify;'><strong><a rel='nofollow' href='{$deeplink_web}' target='_blank'>{$title}</strong></a> el {$date}</li>";