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 | 31 |
Tags
- BFS
- baekjoon 2667
- spring boot
- 단지 번호붙이기
- baekjoon 16953
- beakjoon11725
- backjoon 16173
- websecurityconfiguration
- 백준 섬의갯수
- CodingTest
- 백준 2667 java
- 안전영역 java
- baekjoon 2468
- Error
- baekjoon
- springboot
- beakjoon
- coding test
- baekjoon 4963
- bytebuddyinterceptor
- baekjoon1012
- beakjoon 1697
- 백준 현수막
- exprectedbelow
- java.lang.nosuchmethoderror
- baekjoon 3187
- html error
- baekjoon 14714
- attvalue
- dfs
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으로 변경하도록 한것.