level 7
转一下编码格式
RandomAccessFile accessFile = new RandomAccessFile("dd", "rw");
String name = "中国china";
System.out.println(name);
byte[] bs = name.getBytes();
accessFile.write(bs);
RandomAccessFile accessFile2 = new RandomAccessFile("dd", "rw");
byte[] b1 = new byte[] { accessFile2.readByte(), accessFile2.readByte() };
String china = new String(b1, "gbk");
System.out.print(china);
byte[] b2 = new byte[] { accessFile2.readByte(), accessFile2.readByte() };
String china2 = new String(b2, "gbk");
System.out.print(china2);
转成gbk这样我的输出正常了
2013年03月19日 05点03分
3
你这个好难读
2013年03月19日 05点03分
回复 Zebe_32 :就是汉字的不读char读2个byte然后在转成字符串
2013年03月19日 06点03分