}
public String autoDetectEncoding(byte[] bytes) {
CharsetDetector cd = new CharsetDetector();
cd.setText(bytes);
CharsetMatch charsetMatch = cd.detect();
String charSet = charsetMatch.getName();
int confidence = charsetMatch.getConfidence();
logger.info("CharsetMatch: {} ({}% confidence)", charSet, confidence);
setSelectedItem(charSet);