myeclipse中文乱码就出现一个问号 代码如下 请看看 路径中的文件就是 UTF-8的格式 但是结果出书的是?
记事本中没有?输出的结果却有一个?packagecn.yinlong9;importjava.io.*;publicclassYinlong9{publicstaticv...
记事本中没有? 输出的结果却有一个?
package cn.yinlong9;
import java.io.*;
public class Yinlong9 {
public static void main(String[] args) {
InputStreamReader fr=null;
BufferedReader br=null ;
try {
FileInputStream fis = new FileInputStream("C:/Users/long/Desktop/yinlong2/myDoc/hello4.txt");
fr=new InputStreamReader(fis,"UTF-8");
br = new BufferedReader(fr);
String line = null;
while ((line = br.readLine())!= null) {
System.out.println(line);
}
} catch (IOException e) {
try {
br.close();
fr.close();
} catch (IOException e1) {
e1.printStackTrace();
}
System.out.println(e.getMessage());
}
}
} 展开
package cn.yinlong9;
import java.io.*;
public class Yinlong9 {
public static void main(String[] args) {
InputStreamReader fr=null;
BufferedReader br=null ;
try {
FileInputStream fis = new FileInputStream("C:/Users/long/Desktop/yinlong2/myDoc/hello4.txt");
fr=new InputStreamReader(fis,"UTF-8");
br = new BufferedReader(fr);
String line = null;
while ((line = br.readLine())!= null) {
System.out.println(line);
}
} catch (IOException e) {
try {
br.close();
fr.close();
} catch (IOException e1) {
e1.printStackTrace();
}
System.out.println(e.getMessage());
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询