Reading a UTF-8 Encoded File

public static String parseTemplate(String templatePath) {

File aFile = new File(templatePath);
InputStreamReader reader = null;
String template;
StringBuffer temp = new StringBuffer();
int counter = 0;

try {

FileInputStream inStream = new FileInputStream(aFile);

reader = new InputStreamReader(inStream, “utf8”);

BufferedReader inBuf = new BufferedReader(reader);

while ((template=inBuf.readLine()) != null) {

if(counter == 0){

template = template.substring(1,template.length());

}

System.out.println(“inBuf ” + template);

temp.append(template + “n”); // read a line from the file

counter++;

}

inBuf.close();

} catch (Throwable e) {

e.printStackTrace();

}

template=temp.toString();

System.out.println(“FIO ” + template);

return template;

}