为什么用io流复制文件的时候用 utf-8编码 目标文件没有出现乱码,而使用 gbk编码 就会出现乱码?gbk编码没有用武之处吗?
代码如下:
//目标文件没有出现乱码
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(readStr),"utf-
8"));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream
(writeStr),"utf-8"));
//目标文件出现乱码
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(readStr),"gbk"));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream
(writeStr),"gbk"));
|