title: How to Unescape a JavaScript string in Ruby
body: <p>What is the simplest way to unescape the following string in Ruby.</p>
  
  <h3>Sample Input</h3>
  
  <pre><code>str = "\\u003Cul id=\\\"list_example\\\"\\u003E\\n\\t\\u003Cli class=\\\"item_example\\\"\\u003EHello\\u003C/li\\u003E\\n\\u003C/ul\\u003E\\n\\n"
  puts str # =&gt; \u003Cul id=\"list_example\"\u003E\n\t\u003Cli class=\"item_example\"\u003EHello\u003C/li\u003E\n\u003C/ul\u003E\n\n
  str.encoding # =&gt; #&lt;Encoding:UTF-8&gt;
  </code></pre>
  
  <h3>Desired Output</h3>
  
  <pre><code>puts str #=&gt;
  &lt;ul id="list_example"&gt;
    &lt;li class="item_example"&gt;Hello&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>