Sendgrid-nodejs: subject in dynamicTemplateData is not encoding correctly

Created on 27 Jul 2018  路  6Comments  路  Source: sendgrid/sendgrid-nodejs

Issue Summary

if subject contains ', it doesn't encode correctly. However, it works fine in email body, eg. Some'd One looks good in body content.

Steps to Reproduce

  1. Set subject to {{subject}}
  2. Set dynamicTemplateData = {subject: "You've been"}
  3. Email subject become You've Been

Technical details:

  • sendgrid-nodejs Version: 6.3.1
  • Node.js Version: v9.3.0
unknown or a hacktoberfest help wanted question

Most helpful comment

@januszhou @geekyd @nvthai

We actually have a note about this in our docs. The encoding that happens is just part of handlebars and is talked about in handlebars documentation:

Handlebars HTML-escapes values returned by a {{expression}}. If you don't want Handlebars to escape a value, use the "triple-stash", {{{.

So with all that said make sure you are using "triple-stash", {{{.

All 6 comments

Hi @januszhou,

Thanks for reporting this! I've added this to our backlog for further investigation.

With Best Regards,

Elmer

@thinkingserious I had a look at this one & it seems like the sendgrid API does not support some special characters ' , ` in the subject. Check this.

screen shot 2018-10-08 at 1 21 49 am

@thinkingserious i faced same issue. Is there any update on this please?

@januszhou @geekyd @nvthai

We actually have a note about this in our docs. The encoding that happens is just part of handlebars and is talked about in handlebars documentation:

Handlebars HTML-escapes values returned by a {{expression}}. If you don't want Handlebars to escape a value, use the "triple-stash", {{{.

So with all that said make sure you are using "triple-stash", {{{.

@kylearoberts it works!
thank a lot !

Going to close it since we have a fix now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wooyah picture wooyah  路  4Comments

agostonbonomi picture agostonbonomi  路  3Comments

metalshan picture metalshan  路  3Comments

TobiahRex picture TobiahRex  路  3Comments

umarhussain15 picture umarhussain15  路  3Comments