// TIKA-341 without enabling input filtering (stripping of tags) the
// short HTML tests don't work well.
detector.enableInputFilter(true);
detector.setText(stream);
for (CharsetMatch match : detector.detectAll()) {
if (Charset.isSupported(match.getName())) {
metadata.set(Metadata.CONTENT_ENCODING, match.getName());
// TIKA-339: Don't set language, as it's typically not a very good
// guess, and it can create ambiguity if another (better) language