0

Here's an example string, I want to decode the special characters :

"<div class="c1-snippet">
    Let&rsquo;s see if you can run Troubleshooter. Select the &lt;strong&gt;Start&lt;/strong&gt; button, 
    select &lt;strong&gt;Settings&lt;/strong&gt; &gt; &lt;strong&gt;Update &amp;amp; security&lt;/strong&gt; 
 </div>"

I tried renderHTML from 'react-render-html', either use it once or twice, it's only render unescaped parts.

Troubleshooter. 
Select the <strong>Start</strong> button, 
select <strong>Settings</strong> > 
<strong>Update &amp; security</strong> > <strong>Activation</strong>
Jie Hu
  • 539
  • 1
  • 5
  • 16

1 Answers1

1

Install the following package: https://www.npmjs.com/package/html-escape-unescape

Import it in the module.

Use like this:

{{ someStringToBeEscaped | escape }}
{{ someStringToBeUnescaped | unescape }}
Swati
  • 234
  • 2
  • 10