Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- springboot
- Swagger
- websecurityconfiguration
- java.lang.nosuchmethoderror
- bytebuddyinterceptor
- jsonignore
Archives
- Today
- Total
NOT FOUND
response because it is invalid java.lang.IllegalArgumentException: The Unicode character 본문
spring boot
response because it is invalid java.lang.IllegalArgumentException: The Unicode character
신토불이 2024. 8. 8. 12:13The HTTP response header [Content-Disposition] with value [attachment; filename="
과제 제출.zip"] has been removed from the response because it is invalid java.lang.IllegalArgumentException: The Unicode character [과] at code point [44,284] cannot be encoded as it is outside the permitted range of 0 to 255
zip 파일 다운로드 중
StreamUtils.copy(fis, zipOut); 부분에서 에러가 발생했다.
response 헤더 부분에서 한글을 사용해서 나는 에러였다. (디버그 시 copy에서 에러가 나지만)
response.addHeader("Content-Disposition", "attachment; filename=\"과제 제출.zip\"");
response.addHeader("Content-Disposition", "attachment; filename*=UTF-8''" + URLEncoder.encode(zipFileName+".zip",
StandardCharsets.UTF_8).replace("+", "%20"));
위와 같이 utf-8로 인코딩 해주면 된다.
replace는 띄어쓰기가 크롬에서 + 로 그대로 출력되어서 +의 경우 %20으로 변경하도록 한것.