架构师之乱码------BufferedReader乱码解决
1.前言。
如题。
2.代码。
问题代码:
BufferedReader reader = new BufferedReader(new FileReader( new File(path)));
修正后无乱码的代码:
InputStreamReader isr = new InputStreamReader(new FileInputStream(path), "UTF-8"); BufferedReader reader = new BufferedReader(isr);
3.注意事项。
编码可以改为utf-8,gbk,gb2312,找到属于你的编码。建议字符编码用utf-8.
相关推荐
yanghuashuiyue 2020-11-14
ruancw 2020-08-27
frank0 2020-08-26
wl00 2020-08-26
TuxedoLinux 2020-08-18
程序员生态圈 2020-08-04
lovecodeblog 2020-07-28
Cricket 2020-06-14
Noseparte 2020-06-13
架构技术交流 2020-06-11
舍我其谁 2020-06-09
yuanxiaogang 2020-06-06
范群松 2020-06-06
quguang 2020-06-06
85231843 2020-05-31
ChenRuiyz 2020-05-15
Jaiky杰哥 2020-05-15
DAV数据库 2020-05-07