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