以下我是将网页中某部分的文字取出来,放入生成的txt文件,转换后回车不正常,显示一个小黑方块,请大家帮忙看看,这个应该是编码问题读文件
String temp = "";
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
temp = new String(bytes);转p标记为空格
temp = temp.replaceAll("<p>", "\n");写文件
String pathandname = "D://temp1//" + title + ".txt";
FileOutputStream output = new FileOutputStream(pathandname);
output.write(temp.getBytes("utf-8"));
output.close();
output = null;

解决方案 »

  1.   

    回车换行的编码是不会有编码问题的!你不要用txt打开,你用写字板打开估计就对了,或者用word打开哈! 文本文件打开可能会有这个问题!
      

  2.   

    to wmzsl(王明哲)你说的没错,我用写字扳打开就没问题,可是我需要用记事本打开啊
      

  3.   

    temp = temp.replaceAll("<p>", "\n");"\n"换成"\r\n"就好了
    试过了?
      

  4.   

    \n是ASCII码,在Unicode里加入ASCII码当然是黑点了哦.楼上的方法你试试.呵呵.