I have a little sample program which extracts some information from an HTML document.
import org.jsoup.*;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
public class TestSoup {
public static void main(String[] args) {
String html = "<p>An <a href='http://example.com/'><b>exa mple</b></a> link.</p>";
Document doc = Jsoup.parse(html);
Element link = doc.select("a").first();
String linkText = link.text(); // "example""
System.out.println(linkText);
}
}
If you've worked with jSOup you'll know that the output of this should be exa mple
but the output is exaámple
. Why is jSoup not unescapting my HTML entities properly or am i simply doing this wrong?
All my HTML entities get unescaped incorrectly and not only