当前页面: 开发资料首页 → J2SE 专题 → FileInputStream读汉字的问题???
FileInputStream读汉字的问题???
摘要: FileInputStream读汉字的问题???
//Test.txt的内容为 好
// 好 的u码为 /u597D
// 应该是 186 ,195
// 或者是 ba , c3 //在哪里看的,分开存储
InputStream is = new FileInputStream("Test.txt");
while ( true )
{
String str = "";
readOutInt = is.read();
str += Integer.toHexString(readOutInt); //186,并转换成 ba
readOutInt = is.read();
str += Integer.toHexString(readOutInt); //195,并转换成 c3 // str = "bac3"
//System.out.println("/u" + str); //输出 好 , b不能运行
if ( readOutInt = is.read() ) break; //退出循环
}
abc.getBytes("ISO8859_1"),"gb2312")
应该通过这个方式来转换的
流里面不知道是不是这样
好象这个方法不太好
to :
yahhuop(霁雨轩主) ( ) 信誉:100 Blog
谢谢回复
up
up