将含有中文字符的txt读取出来,并在eclipse里显示出来,eclipse里也有run config的common里有配置输出字符流编码设置。 java
输入流编码设置为GBK就OK了 eclipse
//read the chinese string. public void readFile() throws Exception{ BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream("F:\\estateTable.txt"),"GBK")); String strLine=null; if ((strLine = reader.readLine()) != null){ System.out.println(strLine); } reader.close(); }