Here you can find the source of isUTF8Encoding(String path)
public static boolean isUTF8Encoding(String path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; public class Main { public static boolean isUTF8Encoding(String path) throws IOException { InputStream in = new java.io.FileInputStream(path); byte[] b = new byte[3]; in.read(b);/* w w w.jav a2 s . c o m*/ in.close(); if (b[0] == -17 && b[1] == -69 && b[2] == -65) return true; else return false; } }