用reader支持unicode,自然就可以显示中文了BufferedReader br=new BufferedReader(new File("open.txt"));String inFile;
.............
.............
.............
.............
.............
.............
解决方案 »
- 找不到符号 符号:构造函数lady(java.lang.String,Cat) 类:lady Lady l1 = new Lady("mimi",c);)
- 新手请教
- 关于clathpath配置的问题,来者有分
- Java有Group功能吗?
- 很有挑战的java IO 问题,如何实现byte[]转化为FileInputStream,不经过存储为文件
- java如何在栈内存中分配数组?
- 为什么我从流中读数据的问题(详见内)?
- jdbc-odbc的SQL语言使用的疑问
- 请问怎么用Java实现一个URL的遍历??急!!!!
- Java可以调用Win32API和COM的东西吗?-netix
- 请教关于强制类型转换
- 都说Java中可以通过接口实现多继承,但具体怎么实现呢?
你写个类
class ChineseTrans
{
public static String toChinese(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "UTF-8");
return strvalue;
}
}catch(Exception e){
return null;
}
}
}
把程序改下试试
RandomAccessFile openFile=new RandomAccessFile("open.txt","r");
String inFile;
inFile=ChineseTrans.toChinese(openFile.readLine());
while(inFile!=null)
{
System.out.print(inFile);
inFile=ChineseTrans.toChinese(openFile.readLine());
}
openFile.close();