!!!Java 文字コード判定 [Java]{{cateogry 文字化け}} *http://code.google.com/p/juniversalchardet/source/browse/trunk/src/org/mozilla/universalchardet/prober/Big5Prober.java public static String detectEncoding(String text) { String encoding = null; try { UniversalDetector detector = new UniversalDetector(null); InputStream is = new StringInputStream(text); byte[] buf = new byte[1024]; int nread; while ((nread = is.read(buf)) > 0 && !detector.isDone()) { detector.handleData(buf, 0, nread); } detector.dataEnd(); encoding = detector.getDetectedCharset(); detector.reset(); } catch(Exception e) { e.printStackTrace(); } return encoding; }