티스토리 뷰

한글로 된 파일명을 다운로드 하는 경우, 파일이 깨졌다.


아래의 코드로 해결.


String zipfileNm = new String("한글".getBytes("UTF-8"), "ISO-8859-1");

HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "application/octet-stream");
responseHeaders.add("Content-Disposition", "attachment; filename=\"" + zipfileNm + "\"");

return new HttpEntity<byte[]>(zipFile, responseHeaders);


아래의 글을 참고 하였다.


참고: https://okky.kr/article/95492

댓글
공지사항
최근에 올라온 글
링크
«   2024/05   »
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
글 보관함