先上代码:
但是输出的中文还是乱码。
eclipse里边修改TestChinese.java文件的编码为utf-8,
再执行就没有乱码了 :D
public class TestChinese {
public static void main(String[] args) throws IOException{
test3();
}
public static void test3() throws IOException{
InputStreamReader in=new InputStreamReader(new FileInputStream("e:/a.txt"),"utf-8");
BufferedReader br=new BufferedReader(in);
String s=null;
while((s=br.readLine())!=null){
System.out.println(s);
}
}
}
但是输出的中文还是乱码。
eclipse里边修改TestChinese.java文件的编码为utf-8,
再执行就没有乱码了 :D