Prestashop: Accented & special characters misinterpreted in customer service messages

Created on 29 Apr 2020  ·  25Comments  ·  Source: PrestaShop/PrestaShop

Describe the bug

Accented & special characters misinterpreted in customer service messages (SAV in french).

Expected behavior

A well interpretation of accented & special characters as customer wrote it in original message.

Steps to Reproduce

Steps to reproduce the behavior:

  1. In FO, write a message with accented & special characters as customer
  2. In BO, in SAV > SAV page (in FR), message is wrong interpreted

Screenshots

sav-accents

Some messages are unreadable!
accents

Additional information

  • PrestaShop version: 1.7.6.4 (fresh install, classic theme, no core/override change)
  • PHP version: 7.1
1.7.6.4 1.7.6.5 BO Customer service No change required

Most helpful comment

Hi @florine2623 ,
So if no PR, issues are closed? Problem isn't here?
I asked if I have to work on a PR, but if you close issue that means is there no problem.
Have you try to reproduced it? On which versions? Is it fixed on v1.7.7?
A better support is required.

All 25 comments

Thanks for opening this issue! We will help you to keep its state consistent

Hi @Klemart3D,

Please update your PHP version to 7.2 and take a look a this documentation: https://devdocs.prestashop.com/1.7/basics/installation/system-requirements/

I tried to reproduce the bug and there is no issue on special characters. Here is the screenshot:
image

Do you have an error when you inspect in console mode?

Hi @prestascott,

Thanks for your answer.
I can't update a PHP version just for an accent issue. As explained in devdocs, PrestaShop 1.7.6.x must supports PHP 7.1 (if don't, please change it to "Not supported").

Error is also in source code as pointed by developer tool (FF/Chrome):
screen 1

Here is my phppsinfo:

PHP PrestaShop Info

Perhaps similar to: #9726
Possibly PR (merged for 1.7.7.0): #15840

Please go to: \themes\default\template\controllers\customer_threads\helpers\view\concerned_file

and replace these lines: {$message.message|escape:‘html’:’UTF-8’|nl2br}
by: {$message.message|unescape:‘html’:’UTF-8’|nl2br}

You can also remove these lines: |escape:‘html’:’UTF-8’|nl2br when there is $message.message.

Thanks @prestascott, there what I did:

In/admin***/themes/default/template/controllers/customer_threads/helpers/view/message.tpl
I changed: {$message.message|escape:‘html’:’UTF-8’|nl2br}
By: {$message.message|unescape:‘html’:’UTF-8’|nl2br}

And in/admin***/themes/default/template/controllers/customer_threads/helpers/view/timeline_item.tpl
I changed: {$timeline_item.content|nl2br}
By: {$timeline_item.content|unescape:'html':'UTF-8'|nl2br}

Now, messages are well displayed. Do have we to create a PR for this?

For my installation worked only when i deleted "|unescape:‘html’:’UTF-8’|nl2br".
Thanks to both of you.

Hi @Klemart3D ,
There's no PR for that issue. If you have one, do not hesitate to create one.
Thanks !

Hi @florine2623 ,
So if no PR, issues are closed? Problem isn't here?
I asked if I have to work on a PR, but if you close issue that means is there no problem.
Have you try to reproduced it? On which versions? Is it fixed on v1.7.7?
A better support is required.

Hi @Klemart3D ,
No, because that issue can't be reproduced in neither PS1.7.6.5 and PS1.7.7.

Please see the screenshots below :
PS1.7.6.5
Capture d’écran 2020-05-07 à 16 49 35
Capture d’écran 2020-05-07 à 16 47 49
PS1.7.7.
Capture d’écran 2020-05-07 à 16 48 20
Capture d’écran 2020-05-07 à 16 48 20
Thanks!

@florine2623 thats a bug or a php error?

The problem is present in prestashop 1.7.6.5 with PHP 7.2

in version 1.7.6.4 it also exists. what should i do to fix it? or will it be fixed in a later version of prestashop?
@Betafer

in version 1.7.6.4 it also exists. what should i do to fix it? or will it be fixed in a later version of prestashop?
@Betafer

If you can fix it it would be better.
Thanks

Ping @florine2623

@florine2623

Hi,

the solutions posted seems to work for messages between customer and store, but won't work if the message is sent from the observations box from carrier checkout page.
However with the help from @manu20gm from the forums solves the display issue by decoding the $message with html_entity_decode() function in /Backo
Officefolder/themes/default/template/controllers/orders/helpers/view/view.tpl
{html_entity_decode($message['message']|escape:'html':'UTF-8'|nl2br)}

forum link: https://www.prestashop.com/forums/topic/962368-ps175-error-caracteres-tiles-y-%C3%B1-en-mensajes-de-clientes-solucionado/
This error is present with 1.7.6.5 and php 7.2

The problem is still present in prestashop 1.7.6.6 with PHP 7.2.32

' is changed by '

Schermata 2020-07-22 alle 08 49 11

@Betafer Did you tried the solution I mentioned?

yes, it work, thanks.
it would be nice if the fix was implemented in prestashop and not having to do it after every update.

hi to all
this problem continue to be present in the 1.7.6.8
it is necessary to replace "escape" with "unescape"
into
{$message.message|unescape:'html':'UTF-8'|nl2br}
/admin*/themes/default/template/controllers/customer_threads/helpers/view/message.tpl

and

{$message['message']|unescape:'html':'UTF-8'|nl2br}
/admin*/themes/default/template/controllers/orders/helpers/view/view.tpl

it is necessary to add a bugfix
bye

@florine2623 what appens with this bug?

@maofree Sounds like a very bad idea. What if someone sends an HTML encoded message of a script?

@joaolago1113 you can suggest another solution to fix that problem

@maofree @joaolago1113 @alfonsolr09

You guys can check this PR with the fix:

https://github.com/PrestaShop/PrestaShop/pull/15840

It will be released in the 1.7.7 release but you guys can do it easily, it's only one lane modification.

Was this page helpful?
0 / 5 - 0 ratings