+ "<body></body></html>";
Metadata metadata = new Metadata();
new HtmlParser().parse (
new ByteArrayInputStream(test.getBytes("UTF-8")),
new BodyContentHandler(), metadata, new ParseContext());
assertEquals("UTF-8", metadata.get(Metadata.CONTENT_ENCODING));
metadata = new Metadata();
metadata.set(Metadata.CONTENT_TYPE, "text/html; charset=ISO-8859-1");
new HtmlParser().parse (
new ByteArrayInputStream(test.getBytes("UTF-8")),
new BodyContentHandler(), metadata, new ParseContext());
assertEquals("ISO-8859-1", metadata.get(Metadata.CONTENT_ENCODING));
}