@Test public void testOutputEncoding() { Document doc = Jsoup.parse("<p title=π>π & < > </p>"); // default is utf-8 assertEquals("<p title=\"π\">π & < > </p>", doc.body().html()); assertEquals("UTF-8", doc.outputSettings().charset().displayName()); doc.outputSettings().charset("ascii"); assertEquals(Entities.EscapeMode.base, doc.outputSettings().escapeMode()); assertEquals("<p title=\"π\">π & < > </p>", doc.body().html()); doc.outputSettings().escapeMode(Entities.EscapeMode.extended); assertEquals("<p title=\"π\">π & < > </p>", doc.body().html()); }
@Test public void testXhtmlReferences() { Document doc = Jsoup.parse("< > & " ' ×"); doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml); assertEquals("< > & " ' ×", doc.body().html()); }