This issue has been migrated from the Forge. Read the original ticket here.
I found problem at older and new prestashop 1.7 versions also.
Order message which is added by customer on delivery step not working correctly with UTF8.
聽
When i want use for example this message :
"谩no m谩m sa dobre" Then in ps_message is inserted this "谩no m谩m sa dobre" so when i will return from payment step to delivery step then prestashop return that wrong message.
Create new order and use my message as order message.
This comment has been migrated from the Forge. Read the original comment here.
Hi Richard,
I manage to reproduce the issue with the last version: 1730-rc1.
We will see how to fix it.
Best regards, Khouloud
Hi, I've solved this problem with overload the CheckoutSessionCore class.
class CheckoutSession extends CheckoutSessionCore
{
public function setMessage($message)
{
$this->_updateMessage($message);
return $this;
}
private function _updateMessage($messageContent)
{
if ($messageContent) {
if ($oldMessage = Message::getMessageByCartId((int)$this->context->cart->id)) {
$message = new Message((int)$oldMessage['id_message']);
$message->message = $messageContent;
$message->update();
} else {
$message = new Message();
$message->message = $messageContent;
$message->id_cart = (int)$this->context->cart->id;
$message->id_customer = (int)$this->context->cart->id_customer;
$message->add();
}
} else {
if ($oldMessage = Message::getMessageByCartId($this->context->cart->id)) {
$message = new Message($oldMessage['id_message']);
$message->delete();
}
}
return true;
}
}
Sorry for my bad english !聽
Best regards, Batsare
Hi @Batsare,
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
Hi @khouloudbelguith,
Currently,I haven't time, but I will try to do it later.
Hello,
I have the same problem, but when I copy and paste the Batsare's code that show blank screen.
Anybody Know why it can be?
Thanks!
Hi,
Where did you paste the code ?
Have you enabled the overload in prestashop?
Hi,
I created a new file on /override/classes/checkout / CheckoutSession.php
Is that wrong?
Thanks for your fast anwer
Hi,
This is the good file...
Have you enabled the overload in Prestashop ?
Please, try clear the cache.
This could be fixed without removing safeOutput function in CheckoutSession.php.
Presta developers can easily change in classes/tools.php for:
public static function htmlentitiesUTF8($string, $type = ENT_QUOTES)
{
if (is_array($string)) {
return array_map(array('Tools', 'htmlentitiesUTF8'), $string);
}
return htmlspecialchars((string)$string, $type, "UTF-8");
//USE htmlspecialchars NOT htmlentities
}
Hi @lutol,
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
Hi,
@lutol thanks you! That's work on my site.
Hi all,
I created a PR: https://github.com/PrestaShop/PrestaShop/pull/12103 to fix the issue.
@lutol Thanks for your fix!
Any fix for 1.7.6.0 ?
@seederp2p, sorry it is not fixed yet.
Thanks for your understanding!
@khouloudbelguith the fix provided by lutol for the messages work.
But there is no fix for the private messages! please reopen the other ticket.
@seederp2p, Here's the PR: #14605 to fix this issue for the private note.
Thanks!
Order messages are still not working after 1.7.6.1, still getting "Szeptember végére kérem a szállítást, vagy október elejére. Köszönöm szépen! :)"
@Szobi81, the issue is not fixed yet.
Thanks!
Do we know about when you gonna make it?
Yes, bug is known for +12 months now..
This appears to still be a problems in PS 1.7.6.5
Customer messages in BO with Nordic letters (脝 脴 脜) do not appear correct. Works fine in PS 1.6
Still an issue in 1.7.6.9.

@sm0rgm
As you can see on the right, this issue has been fixed for the 1.7.7.0
