byte[] bytes = IOUtils.toByteArray(new FileInputStream(filename));
Set<String> triedCharsets = new HashSet<String>();
ICharsetDetector[] detectors = new ICharsetDetector[] { new CharsetDetectorIcu(), new CharsetDetectorJcd(), };
for ( ICharsetDetector detector : detectors ) {
Collection<String> charsets = detector.detectCharset(bytes);
System.out.println(detector.getClass().getSimpleName()+ ": Detected charsets: " +charsets);
if ( true ) {