Jump to content

[Solved] HTML Entities encode when editing email templates


Recommended Posts

When i use the translations tool, in back-office, to edit email templates, after save the changes, if i open the file in a text editor, i will see that all words with non English special characters will be encode as html entities... this is very annoying when you want to edit the file directly :angry:

 

Before edit in back office the code in file is like this:

<td align="left">Agora poderá fazer as suas compras e consultar as suas encomendas no nosso site: <a href="{shop_url}">{shop_name}</a>.</td>

 

After edit (without make any change) and save in back office:

<td align="left">Agora poderá fazer as suas compras e consultar as suas encomendas no nosso site: <a href="{shop_url}">{shop_name}</a>.</td>

 

I think that is a bug, because it is not necessary to save as html entities, because prestashop use utf-8.

 

The only problem is when we want to edit directly the file, because with or without html entities, encoding the special characters, the emails works fine .

 

It is possible to turn off html entities encoding when emails translations are saved?

Link to comment
Share on other sites

A find one workaround to fix this...

 

In AdminTranslations.php at line 694 i find this code:

$content = Tools::htmlentitiesUTF8($content);
$content = htmlspecialchars_decode($content);

 

and replaced by this one:

$content = Tools::htmlentitiesDecodeUTF8($content);

 

As you can see, by default, prestashop is encoding as html entities the content from email templates, and after just decode some characters.

 

With the change i made, will always save the content without html entities, just save as utf-8 :rolleyes:

 

I don't see any difference in emails after this change... it seems to work fine, but if after i done more tests, i find any issue, i will post here ;)

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

Sorry for the delay in the reply...

 

In the time this was done as part of a Freelancer job to fix several bugs in Shop and the client never more complaint about this, therefore i think no issues where caused by this change.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...