Tuesday, January 29, 2008

java读取utf-8编码文件

发觉直接读中文会出现乱码,所以要这样:
BufferedReader br=new BufferedReader(new InputStreamReader (new FileInputStream(new File("utf-8.txt")),"UTF-8"));

No comments: