- import java.io.*;
- public class DocReader {
- public static void main(String args[]) throws IOException
- {
- BufferedReader bufr =
- new BufferedReader(new InputStreamReader(new FileInputStream("D:\\abc.txt"),"utf-8"));
- BufferedWriter bufw =
- new BufferedWriter(new OutputStreamWriter(System.out));
- String line;
- while((line=bufr.readLine())!=null)
- {
- bufw.write(line);
- bufw.newLine();
- bufw.flush();
- }
- }
- }
复制代码 d盘下的abc.txt为uft-8编码的文件。内容为 你好。
可是运行结果确是 ?你好。
求解。
|
|