sudan kanakavel sudan kanakavel - 3 months ago 25
HTML Question

Dynamic meta description apostrophe is replaced by ' ASCII value

In my

meta
-
description
(which is dynamic), the apostrophe is replaced by
'
when I do CTRL + U / View source, and in Google Search.

<meta name="Description" content="Discover Sonam Kapoor&#x27;s look in Dolly Ki Doli, Dolly/Madhuri/Priya/Bhagyashree,Red Net Kameez with Patiala,Red Art Silk Patiala Suit,RITIKA SACHDEVA Gold finish"


It should be "sonam kapoor's" but I have "Sonam Kapoor&#x27;s". How to fix this?

I am using node.js, html, mongodb.

I did console.log in index.js and checked it is printing "Sonam Kapoor's" correctly so fetching from database correctly but in web page view source code it is coming "Sonam Kapoor &#x27;s" ASCII value.

Answer

Hi finally i solved it using following code

    Handlebars.registerHelper('asciim', function(text) {
  text = Handlebars.Utils.escapeExpression(text);
  return new Handlebars.SafeString(result);
});

Thanks everybody