Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

juice version breaks html encoding #2921

Open
Paso opened this issue Nov 21, 2024 · 1 comment
Open

juice version breaks html encoding #2921

Paso opened this issue Nov 21, 2024 · 1 comment

Comments

@Paso
Copy link

Paso commented Nov 21, 2024

Describe the bug
I have the problem that html entities in my email gets double encoded, ie   becomes  .

If I remove my <mj-style inline="inline"> blocks everything works again and during reproduction I have discovered that it has something to do with the dependency juice: "^10.0.0" from mjml-core. Bumping the dependency to "^10.0.1" solves the problem.

To Reproduce
See package.json and index.js below. Running with "juice": "10.0.0" in the package.json outputs the incorrect encoding.

{
  "name": "mjmlbug",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "mjml": "4.15.3",
    "juice": "10.0.0"
  }
}
const mjml2html = require('mjml');
const mjml = `
<mjml>
  <mj-head>
    <mj-preview>
      Preview &nbsp;
    </mj-preview>
    <mj-style inline="inline">
    </mj-style>
  </mj-head>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text>Body &nbsp;</mj-text>
      </mj-column>
    </mj-section>

  </mj-body>
</mjml>
`;
const results = mjml2html(mjml, {});
const html = results.html;
console.log(html);

Expected behavior
&nbsp; in the mjml should remain as &nbsp; in the HTML

MJML environment (please complete the following information):

  • OS: Linux
  • MJML Version: 4.15.3
  • MJML tool used: nodejs

Affected email clients (for rendering issues):

  • Email Client: Gmail
  • Browser: Google Chrome
@iRyusa
Copy link
Member

iRyusa commented Dec 3, 2024

Edit: OK I've misread the issue. It should be fixed in 5.x branch as it use the latest juice version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants