BufferedReader读取UTF-8文件中文乱码

引用:http://blog.sina.com.cn/s/blog_6a5a46790100lhub.html

读取html文件乱码:
BufferedReader read = new BufferedReader(new FileReader(new File(filename)));

解决办法:
InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "UTF-8");
BufferedReader read = new BufferedReader(isr);

因为InputStreamReader和BufferedReader都继承自Reader,而BufferedReader的构造器又是Reader.

你可能感兴趣的:(bufferedreader)