Skip to content

Instantly share code, notes, and snippets.

View yaochao's full-sized avatar
🌴
On vacation

yaochao yaochao

🌴
On vacation
View GitHub Profile
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 5, 2025 07:42
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@qlong8807
qlong8807 / spring下载文件名乱码.java
Created December 4, 2018 03:13
spring下载文件,解决中文文件名乱码问题
response.setCharacterEncoding(request.getCharacterEncoding());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM.toString());
String realFileName = URLEncoder.encode(realFileName, StandardCharsets.UTF_8.toString());
// 解决中文文件名乱码关键行
response.setHeader("Content-Disposition", "attachment; filename=\"" + realFileName + "\"; filename*=utf-8''" + realFileName);
Path path = Paths.get(filePath+filename);
Files.copy(path, response.getOutputStream());
response.flushBuffer();