unescape() function from underscore.js not working
<p>I need to decode html entities such as: <code>&amp;amp;</code>, <code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;quot;</code>, <code>&amp;#96;</code> and <code>&amp;#x27;</code>.</p>

<p>As recommended in this <a href="https://stackoverflow.com/questions/5796718/html-entity-decode">SO post</a>, I was trying to use <code>_.unescape()</code> from <a href="http://underscorejs.org/#unescape" rel="nofollow noreferrer">underscore.js</a> for this task.</p>

<p>However, <code>unescape()</code> doesn't seem to have any effect. When I call it e.g. on the following string, it just returns the string itself:</p>

<pre><code>const line = 'Tweag I&amp;#x2F;O | Paris, France &amp;amp Berlin, Germany | Full-time. Give us a shout at jobs@tweag.io!'
</code></pre>

<p>To verify, you can go to <a href="https://jsbin.com" rel="nofollow noreferrer">JSBin</a> and paste the following code: </p>

<pre><code>const line = 'Tweag I&amp;#x2F;O | Paris, France &amp;amp Berlin, Germany | Full-time. Give us a shout at jobs@tweag.io!'
console.log(line)

const decodedLine = unescape(line)
console.log(decodedLine)
</code></pre>

<p>Don't forget to add the <code>underscore.js</code> library by selecting it from the dropdown that appears when you hit the <code>Add library</code> button.</p>

<h3>Update</h3>

<p>As noted in @DanPrince's answer, <code>unescape()</code> only decodes a limited set of characters:</p>

<p><code>&amp;amp;</code>, <code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;quot;</code>, <code>&amp;#96;</code>, <code>&amp;#x27;</code></p>

<p>But then, changing my line from the example above to the following still doesn;t work (even though this time I use <code>&amp;#x27;</code> and <code>&amp;amp;</code>):</p>

<pre><code>const line = `'Tweag I&amp;#x27;O | Paris, France &amp;amp; Berlin, Germany | Full-time. Give us a shout at jobs@tweag.io!'` 
</code></pre>

<h3>Final Update</h3>

<p>I solved my problem by using a different library. Instead of <code>underscore.js</code>, I am now using <a href="https://github.com/mathiasbynens/he" rel="nofollow noreferrer">he</a> which provides <em>exactly</em> the functionality I was looking for.</p>

<p>Now, I can just call <code>decode(line)</code> and <em>all</em> html entities get properly translated. I will be following up on the answers to this question however and accept the answer that explains why <code>unescape()</code> doesn't work as expected.</p>