Magento2: Sales email subject "&" turns to  

Created on 13 Sep 2016  路  7Comments  路  Source: magento/magento2

Preconditions

PHP 7.0.1
Mysql 5.6.31
Apache 2.4.23
Magento 2.0.7/2.1.0/2.1.1

Steps to reproduce

  1. Admin > Stores > General > General > Store Information > Store Name : change store name something having ampersand "&" like Easy&Piggy
  2. Send an order email.

Expected result

  1. Order email subjected: Your Easy&Piggy order confirmation

Actual result

  1. Your Easy&Piggy order confirmation (& is converted to &)

  2. image
Sales Fixed in 2.1.x Clear Description Format is valid Ready for Work Reproduced on 2.1.x bug report

Most helpful comment

any updates on this issue? i see that this issue has no assignment.

All 7 comments

@rbncha thank you for your report.
Could you please add some formatting to the last line? As I see "& is converted to &" instead of "& is converted to &" and it's confusing.
You can just add "\" sign before &

Probably same problem, but with mail subject where ' is '
Add '\' do not works.
On Magento 2.1.1

sans titre 1

Hi,
internal ticket is created MAGETWO-58663

any updates on this issue? i see that this issue has no assignment.

Quick fix is in di.xml

```





In Template.php
```<?php
namespace VENDOR\MODULE\Plugin;

class Template
{
    public function afterGetSubject(
        \Magento\Email\Model\Template $subject,
        $result
    ) {
        return htmlspecialchars_decode((string)$result, ENT_QUOTES);
    }
}

@rbncha, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9

Hi @magento-engcom-team

We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9

That can't be right. As mentioned on the linked PR #9476 , here's the fix: e89d09d2885b51c49c223ff795041fd6aab5fafc
And it seems to be present on 2.2 branch only.

Was this page helpful?
0 / 5 - 0 ratings