解析时:InputStream inputStream = file.getInputStream();
InputStreamReader is =new InputStreamReader(inputStream,"utf-8");
注意在生成输入流时设置utf-8编码。
导出时(这里是使用PrintWriter):在生成输出流时设置utf-8编码
Writer write =new OutputStreamWriter(new FileOutputStream(new File(file,fileName)), "UTF-8");
PrintWriter printWriter=new PrintWriter(write);
网友评论