2

Possible Duplicates:
How can I Decode string?
Java: How to decode HTML character entities in Java like HttpUtility.HtmlDecode?

Hi,

I have string like as an eg "&ampauml;s&amparing;" that needs to be converted like this "äså" pls help me out here.

Thanks in advance

Community
  • 1
  • 1
Anand
  • 1,315
  • 1
  • 12
  • 18
  • possible duplicate of [How can I Decode string?](http://stackoverflow.com/questions/4990943/how-can-i-decode-string) You already asked this question. – Felix Kling Feb 14 '11 at 18:31
  • It is _not_ a duplicate. He is having a concrete problem that is different from the one in the target thread. Perhaps he is giving the wrong data, but with the given data the question differs. – Bozho Feb 14 '11 at 18:47

1 Answers1

3

Have a look at the StringEscapeUtils class in the Apache Commons library. (Specifically the unescapeHtml method).

import org.apache.commons.lang.StringEscapeUtils;

public class Test {
    public static void main(String[] args) {
        String str = "äså";
        System.out.println(StringEscapeUtils.unescapeHtml(str)); // prints äså
    }
}
aioobe
  • 413,195
  • 112
  • 811
  • 826