title: How to convert string with html encoding to Unicode in java
body: <p>I have a string with <code>HTML</code> encoding like below:</p>
  <pre><code>&amp;ETH;&amp;#7897;t nhi&amp;ecirc;n, &amp;#7903; g&amp;#7889;c T&amp;acirc;y B&amp;#7855;c v&amp;#259;ng v&amp;#7859;ng c&amp;oacute; ti&amp;#7871;ng v&amp;oacute; ng&amp;#7921;a d&amp;#7891;n d&amp;#7853;p.
  </code></pre>
  <p>I want to convert this <code>String</code> to <code>Unicode</code>.
  Expected output:</p>
  <pre><code>Ðột nhiên, ở gốc Tây Bắc văng vẳng có tiếng vó ngựa dồn dập.
  </code></pre>
  <p>I found a solution by <a href="https://stackoverflow.com/questions/20799512/convert-decimal-ncrs-code-into-utf-8-in-java-jsp?answertab=active#tab-top">Convert Decimal NCRs Code into UTF-8 in java (JSP)</a> but it only works for strings with all characters which has its format begins with <code>&amp;#</code>.</p>
  <p>With characters begin with <code>&amp;xxxx</code>, using the page <a href="http://www.thesauruslex.com/typo/eng/enghtml.htm" rel="nofollow noreferrer">HTML encoding of foreign language characters</a> I got its encode is html encoding but my input string is the combination of convert HTML Entity (named) and HTML Entity (decimal).</p>
  <p>Does anyone have any suggestion?
  It would be the best if we can make it without adding any additional libraries.</p>
  <p><strong>[UPDATE]</strong> I solved my problem by using <a href="http://commons.apache.org/proper/commons-lang/download_lang.cgi" rel="nofollow noreferrer">Apache library</a> :</p>
  <pre><code>String encodeString = &quot;&amp;ETH;&amp;#7897;t nhi&amp;ecirc;n, &amp;#7903; g&amp;#7889;c T&amp;acirc;y B&amp;#7855;c v&amp;#259;ng v&amp;#7859;ng c&amp;oacute; ti&amp;#7871;ng v&amp;oacute; ng&amp;#7921;a d&amp;#7891;n d&amp;#7853;p.&quot;;
      String unEncodeString = StringEscapeUtils.unescapeHtml4(encodeString);
      System.out.println(&quot;OUTPUT : &quot; + unEncodeString);
  </code></pre>
  <p>=====&gt; <code>OUTPUT : Ðột nhiên, ở gốc Tây Bắc văng vẳng có tiếng vó ngựa dồn dập.</code></p>