Commit 08765610 by 周添尉

修改下载乱码

parent ecd68c96
......@@ -1293,13 +1293,6 @@ public class actAction extends BasicAction {
String uploadold=request.getParameter("uploadold");
if(new File(uploadpath+File.separator+uploadnew).exists()==false){
uploadpath = request.getSession().getServletContext().getRealPath(uploadpath);
try {
// uploadold = new String(uploadold.getBytes("iso8859-1"), "utf-8");
uploadold = new String((uploadold).getBytes("gbk"),"iso8859-1");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
FileUtil fileUtil = new FileUtil();
//文件存放目录
FileObject baseDir = fileUtil.getFile(uploadpath);
......@@ -1313,6 +1306,7 @@ public class actAction extends BasicAction {
e.printStackTrace();
}
//设置response
response.setCharacterEncoding("utf-8");
response.setContentType("application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\""+uploadold+"\"");
......
......@@ -1756,13 +1756,6 @@ public class actAction extends BasicAction {
String uploadold=request.getParameter("uploadold");
if(new File(uploadpath+File.separator+uploadnew).exists()==false){
uploadpath = request.getSession().getServletContext().getRealPath(uploadpath);
try {
// uploadold = new String(uploadold.getBytes("iso8859-1"), "utf-8");
uploadold = new String((uploadold).getBytes("gbk"),"iso8859-1");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
FileUtil fileUtil = new FileUtil();
//文件存放目录
......@@ -1777,6 +1770,7 @@ public class actAction extends BasicAction {
e.printStackTrace();
}
//设置response
response.setCharacterEncoding("utf-8");
response.setContentType("application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\""+uploadold+"\"");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment