做淘宝差不多的网站吗,想自己做网站 有免费的吗,开县做网站,我国网站开发java(IO)读写文件乱码转换UTF-8问题 读取文件String Content ; // 文件很长的话建议使用StringBuffertry {FileInputStream fsnew FileInputStream(文件录取);InputStreamReader isr new InputStreamReader(fis, UTF-8);Buff…java(IO)读写文件乱码转换UTF-8问题 读取文件String Content ; // 文件很长的话建议使用StringBuffertry {FileInputStream fsnew FileInputStream(文件录取);InputStreamReader isr new InputStreamReader(fis, UTF-8);BufferedReader br new BufferedReader(isr);String line null;while ((line br.readLine()) ! null) {Content line;Content \r\n; // 补上换行符}catch (Exception e) { e.printStackTrace();} 写入文件 public static void outFile(String sb) {try {File file new File(G:\\liuhecai.txt);if (file.exists()) {file.delete();}file.createNewFile();FileOutputStream fos new FileOutputStream(file);OutputStreamWriter osw new OutputStreamWriter(fos, utf-8);osw.write(sb);} catch (UnsupportedEncodingException e) {e.printStackTrace();} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}} 转载于:https://www.cnblogs.com/weibanggang/p/9347778.html