这是下载的代码片断:
OutputStream os = response.getOutputStream();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(os));
out.write("hello hello hello");
out.write("<br>");
out.flush();
out.close();
下载的txt文件中,内容为:
hello hello hello
连续的空格自动变为一个。
如何解决?
OutputStream os = response.getOutputStream();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(os));
out.write("hello hello hello");
out.write("<br>");
out.flush();
out.close();
下载的txt文件中,内容为:
hello hello hello
连续的空格自动变为一个。
如何解决?
应该没有什么问题吧
我现在要下载一个文本文件,内容是一个html代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY>
hello, worldhello, lcl I am Chinese.</BODY>
</HTML>可是下载后的文件内容为:
New Document
hello, worldhello, lcl I am Chinese.
html标签居然给过滤了。郁闷