求Java转换流问题,各位大神帮帮忙
作者:互联网
代码:
private static void readerUTF8()throws IOException {
InputStreamReader isr = new InputStreamReader(new FileInputStream(“src\IOTest\utf83.txt”),“utf-8”); int len = 0;
while( (len = isr.read()) != -1) { System.out.print((char)len);//
}
}
输出结果:?你好
utf83.txt文件在win7下面,默认gbk编码,内容只保存你好两个字。你好前面没有任何空格,用另存为保存为utf-8格式。
问题:不知道为啥输出为?你好
标签:Java,大神,len,utf83,帮帮忙,new,txt,InputStreamReader,你好 来源: https://blog.csdn.net/shizhihantu/article/details/113194151