txt文件 里有英文有汉字,英文显示正常,但是汉字显示异常,我可是抄的老湿的代码,不明所以,故问,3Q
```java
package reader;
import java.io.FileReader;
import java.io.IOException;
/**
* @author 小池
* @version 1.0
*/
public class FileReader_ {
public static void main(String[] args) {
/*
String filePath = "d:\\123.txt";
FileReader fileReader = null;
int data = 0;
try {
fileReader = new FileReader(filePath);
while ((data=fileReader.read()) != -1){
System.out.print((char)data);
}
} catch (IOException e) {
e.printStackTrace();
}
*/
String filePath = "d:\\123.txt";
FileReader fileReader = null;
int data = 0;
char[] buf = new char[8];
try {
fileReader = new FileReader(filePath);
while ((data=fileReader.read(buf)) != -1){
System.out.print(new String(buf,0,data));
}
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
if(fileReader != null){
fileReader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
```