我对波兰语字符有疑问。我想将ResponseEntity发送到前端(我正在发送文件,但是我想在前端用波兰语字符设置文件名):
@GetMapping(value = "/generateOneReport/{incidentId}", produces = "application/octet-stream; charset=utf-8")
public ResponseEntity<?> getOneReport(@PathVariable Long incidentId) {
...
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_OCTET_STREAM);
header.set("filename", "polish chars like ó ł ż ź");
return ResponseEntity.ok()
.headers(header)
.contentType(MediaType.parseMediaType("application/octet-stream"))
.body(resource);
但是在前端(Vue.js)中,我得到了
?
代替波兰字符。如何在前面获得波兰字符?我应该在标题中设置某些内容还是应该在前端设置一些内容?
在前端,我希望使用波兰字符:
incidents.generateOneReport(token, row.id)
.then((response) => {
console.log(response.headers.filename);
我尝试过
header.add("Content-Type", "text/html; charset=utf-8");
但没有任何效果。