}
try {
CharsetDetector detector = new CharsetDetector();
detector.setText(is);
CharsetMatch[] matches = detector.detectAll();
for (CharsetMatch match : matches) {
try {
possibleEncoders.add(Charset.forName(match.getName()).newEncoder());
} catch (UnsupportedCharsetException | IllegalCharsetNameException ex) {
// Don't add unsupported charsets to the list