public static void change(String filepath) throws UnsupportedEncodingException, IOException{
BufferedReader buf = null;
OutputStreamWriter pw=null;
String str = null;
String allstr=""; //用于输入换行符的字节码
byte[] c=new byte[2];
c[0]=0x0d;
c[1]=0x0a;
String t=new String(c); buf=new BufferedReader(new InputStreamReader(new FileInputStream(filepath), "GBK"));
while((str = buf.readLine()) != null){
allstr=allstr+str+t;
} buf.close(); pw =new OutputStreamWriter(new FileOutputStream(filepath),"UTF-8");
pw.write(allstr);
pw.close();
}

  尝试用了StringBuffer进行内容的存储,结果乱码,原因待查。最后使用String相加的方式解决。

最新文章

  1. cf723a The New Year: Meeting Friends
  2. Hibernate Spring
  3. 跟我学Windows Azure 五 使用Cloub Service连接Blob Service完成图片的上传
  4. [git]添加项目到git
  5. java 方法调用绑定
  6. PHP 5:PHP语法导向
  7. Spring Boot--war发布
  8. setinIerval和setTimeout的区别?
  9. Python 实现 动态规划 /斐波那契数列
  10. day29 类中的内置函数方法 __str__ __repr__ __call__ isinstance() issubclass()
  11. 百度地图sdk---pc端
  12. Django商城项目笔记No.11用户部分-QQ登录1获取QQ登录网址
  13. poj3017 Cut the Sequence 单调队列 + 堆 dp
  14. alpha冲刺阶段博客集合
  15. c#截取图片
  16. mac 上 sublime text2 快捷键
  17. winfrom 底层类 验证码
  18. JSON/JSONP浅谈
  19. C# -- 泛型(3)
  20. eslint 人性化配置

热门文章

  1. ajax发送验证码
  2. SQL Server中存储过程与函数的区别
  3. springboot核心技术(一)-----入门、配置
  4. sas单变量的特征分析
  5. 使用jstl el表达式对form表单的功能进行区分 比如新建和修改共用一个form
  6. CentOS 6.5 Apache+SVN配置
  7. 禅道Mysql默认密码修改
  8. Vuejs实战项目三:退出系统功能实现
  9. np.random.choice的用法
  10. 关于 webpack的总结