java.nio.charset is built into the JDK: Files.readString, Files.newBufferedReader and Charset handle UTF-8, UTF-16 and dozens of legacy encodings, with strict error reporting through CharsetDecoder. It doesn’t detect encodings or strip a UTF-8 BOM.
juniversalchardet is a small Java port of Mozilla’s detector. It also has helpers that open a Reader with the detected encoding. Pick it when you only need detection.
ICU4J has CharsetDetector, which returns ranked matches with confidence and language and can decode the text for you. It’s a large JAR (~14 MB); pick it if you already use ICU or need its other features.
ICU4JICU4J is the Java version of ICU. Use its CharsetDetector to detect the encoding and language of text files and decode them. Installation and code examples.
java.nio.charsetjava.nio.charset and java.nio.file read and write text files in any encoding in Java. How to read Windows-1252 files, strip a BOM, validate UTF-8.
juniversalchardetjuniversalchardet detects the character encoding of text files in Java, a port of Mozilla's universal charset detector. How to install it.