调试导出的时候,发现如下方法收集到的model.data字符串会出现中文乱码,请问如何设置form参数避免乱码?
/**
* Download file using Spring Controller
*/
@RequestMapping(value = "/export", method = RequestMethod.POST)
public @ResponseBody void Export(HttpServletResponse response, ImportModel model) {
ExcelIOService service = new ExcelIOService();
try {
FileResult result = service.exportFile(model);
response.setContentType(result.getType());
response.setHeader("Content-Disposition", result.getContentDisposition().getValue());
response.setHeader("Content-Length", result.getContentLength());
IOUtils.copy(result.getIs(), response.getOutputStream());
response.getOutputStream().flush();
} catch (IOException ex) {
logger.error(ex.getMessage(), ex.getStackTrace());
throw new RuntimeException("IOError writing file to output stream");
}
}
|