I have problem in reading text file with utf-8 encoding
I'm using java with netbeans 7.2.1 platform
I already configured the java project to handle UTF-8
javaproject==>right click==>properties==>source==>UTF-8
but still get the unknown character output:
????? ???????? ???? ?
the code:
File fileDirs = new File("C:\file.txt");
BufferedReader in = new BufferedReader(
new InputStreamReader(new FileInputStream(fileDirs), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
any other ideas?
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…