保时捷文件下载文件名乱码处理
parent
d5d32720b9
commit
2450a8348e
|
@ -200,6 +200,7 @@ public abstract class SafeCusBaseAction implements Action {
|
|||
String billTable = requestManager.getBillTableName();
|
||||
String id = mapper.selectIdByRequest(billTable, requestInfo.getRequestid());
|
||||
result.put("id", id);
|
||||
result.put("requestid", requestInfo.getRequestid());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@ import javax.ws.rs.core.MediaType;
|
|||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* <h1></h1>
|
||||
|
@ -57,6 +59,11 @@ public class DownloadFileService {
|
|||
}
|
||||
};
|
||||
String imageFileName = docImageInfo.getImageFileName();
|
||||
try {
|
||||
imageFileName = URLEncoder.encode(imageFileName, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignore) {
|
||||
}
|
||||
|
||||
return Response
|
||||
.ok(stream)
|
||||
.header("Content-Disposition", "attachment; filename=\"" + imageFileName + "\"")
|
||||
|
|
|
@ -172,7 +172,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction {
|
|||
}
|
||||
headKeys = sortKey(headKeys);
|
||||
for (String headKey : headKeys) {
|
||||
sb.append(Util.null2String(heads.get(headKey)).replace(" ", " ")).append("\t");
|
||||
sb.append(Util.null2String(heads.get(headKey)).replace("<br>", " ").replace(" ", " ")).append("\t");
|
||||
}
|
||||
sb.deleteCharAt(sb.lastIndexOf("\t"));
|
||||
sb.append("\r\n");
|
||||
|
@ -184,7 +184,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction {
|
|||
try {
|
||||
OutputStreamWriter out = new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath)), StandardCharsets.UTF_8);
|
||||
out.write(sb.toString().replace(" ", " "));
|
||||
out.write(sb.toString().replace("<br>", " ").replace(" ", " "));
|
||||
out.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in New Issue