解决RandomAccessFile写入文件乱码的办法

  out.writeBytes(  "  \r\n  "  );
mess  =   " 写入文件 " ;
byte  buffer[]  =   new   byte [ 1024 ];
buffer  =  mess.getBytes();
out.write(buffer); 
out.close(); // 关闭文件流 
}   catch  (IOException e)  {
  e.printStackTrace();
} 
 

#   re: 解决RandomAccessFile写入文件乱码的办法 2008-03-26 14:54 Find it, try it, experience it   回复   更多评论   

I didn't see any thing here can resolve the problem related to encoding.

#   re: 解决RandomAccessFile写入文件乱码的办法[未登录] 2008-03-26 15:07 AA   回复   更多评论   

明明就是追加,谁都会的

#   re: 解决RandomAccessFile写入文件乱码的办法 2008-03-28 11:07 senlin-blog   回复   更多评论   

你会说明你能,但不一定谁都会的,我是说明解决乱码的问题

#   re: 解决RandomAccessFile写入文件乱码的办法 2008-03-28 13:18 Find it, try it, experience it   回复   更多评论   

But...actually there is nothing related to encoding/decoding, you can have a try to set your JVM default encoding to be iso8859-1 or something other than GB2312/GBK/ GB18030, probly you will get something like "XXX" with your code with your input message "写入文件".

你可能感兴趣的:(jvm,Blog,idea)