Reading a UTF file in Java

String filePath = "foo.txt";                   
BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(filePath), "UTF8"));

String str;
while ((str = br.readLine()) != null) {
// do something with each line
...
}

in.close(); // put this in a finally block

0 comments: