java读取项目路径下的中文文件乱码问题

出现乱码错误:

  

 

 

 

处理方案:

  对文件路径中存在中文的,都要进行URLDecoder.decode(path,"UTF-8")编码转换

  

 

      

 wordContent = URLEncoder.encode(filePath,"UTF-8");     //编码
 wordContent = URLDecoder.decode(filePath,"UTF-8");     //解码

 

posted @ 2018-10-18 09:31  陌笠人灬苼  阅读(2916)  评论(0编辑  收藏  举报