final String test2 = "the name is \u00e1ndre";
Metadata metadata = new Metadata();
parser.parse(
new ByteArrayInputStream(test2.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");
parser.parse(
new ByteArrayInputStream(test2.getBytes("UTF-8")),
new BodyContentHandler(), metadata, new ParseContext());
assertEquals("ISO-8859-1", metadata.get(Metadata.CONTENT_ENCODING));
}