以下我是将网页中某部分的文字取出来,放入生成的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;
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;
试过了?