+ "<title>the name is \u00e1ndre</title>"
+ "</head><body></body></html>";
Metadata metadata = new Metadata();
new HtmlParser().parse (
new ByteArrayInputStream(test1.getBytes("UTF-8")),
new BodyContentHandler(), metadata, new ParseContext());
assertEquals("ISO-8859-1", metadata.get(Metadata.CONTENT_ENCODING));
// Some HTML pages have errors like ';;' versus '; ' as separator
String test2 =
"<html><head><meta http-equiv=\"content-type\""
+ " content=\"text/html;;charset=ISO-8859-1\" />"
+ "<title>the name is \u00e1ndre</title>"
+ "</head><body></body></html>";
metadata = new Metadata();
new HtmlParser().parse (
new ByteArrayInputStream(test2.getBytes("UTF-8")),
new BodyContentHandler(), metadata, new ParseContext());
assertEquals("ISO-8859-1", metadata.get(Metadata.CONTENT_ENCODING));
}