private Charset getCharset(List<DBFRow> firstRows, DBFFileHeader header)
            throws IOException, TikaException {
        //TODO: potentially use codepage info in the header
        Charset charset = DEFAULT_CHARSET;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        for (DBFRow row : firstRows) {
            for (DBFCell cell : row.cells) {
                if (cell.getColType().equals(DBFColumnHeader.ColType.C)) {
                    byte[] bytes = cell.getBytes();
                    bos.write(bytes);
                    if (bos.size() > MAX_CHARS_FOR_CHARSET_DETECTION) {
                        break;
                    }
                }
            }
        }
        byte[] bytes = bos.toByteArray();
        if (bytes.length > 20) {
            EncodingDetector detector = new Icu4jEncodingDetector();
            detector.detect(TikaInputStream.get(bytes), new Metadata());
            charset = detector.detect(new ByteArrayInputStream(bytes), new Metadata());
        }
        return charset;
    }
This is a Tika wrapper around the DBFReader.
<p>
This reads many dbase3 file variants (not DBASE 7, yet!).
<p>
It caches the first 10 rows and then runs encoding dectection
on the "character" cells.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/dbf/DBFParser.java