Java|Java基础
java
Java-Java基础
3d乐多捕鱼 源码,vscode代码高亮异常,ubuntu的dock,远程 重启 tomcat,sqlite怎么定义存储过程,html家乡网页设计源码,hishop数据库链接信息有误,自己服务器如何备案,jquery filter插件,web前端框架通用技术外包,爬虫下载网页,php的注释,武汉seo论坛,springboot响应方法,css隐藏a标签,织梦营销型网站模板,网页设计 输入框,ecshop模板修改教程,动易sf url动易后台分页,wordpress 页面上显示文章,qq空间后台管理系统,java 网页程序lzw
java读取txt文本中如含有中文,可能会出现乱码,解决方案是:
安卓毕业项目源码及说明书,为什么用VScode做js,卡ubuntu界面,tomcat介绍页面进不去,爬虫论文要求,php运行本地程序,正规的seo推广有哪些广告lzw
1、要统一编码,java工程的编码,txt文本编码,java工程中的java文本编码都统一为utf-8;
域名米表源码 php,需要多少g ubuntu,tomcat6启动闪退,介绍爬虫的片段,php用户注册和注册成功页面,seo前沿者lzw
2、利用 InputStreamReader(new FileInputStream(fileUrl), “utf-8”)将文本再次设置为utf-8
InputStreamReader isr; try { isr = new InputStreamReader(new FileInputStream(fileUrl), "utf-8"); BufferedReader read = new BufferedReader(isr); String s=null; List list = new ArrayList(); while((s=read.readLine())!=null) { //System.out.println(s); if(s.trim().length()>1){ list.add(s.trim()); } } System.out.println("OK!"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
更多java知识请关注java基础教学。