Skip to content

Instantly share code, notes, and snippets.

@codethereforam
Created October 21, 2019 11:33
Show Gist options
  • Save codethereforam/65ed28449a18a8d1bd3090958fdc7be4 to your computer and use it in GitHub Desktop.
Save codethereforam/65ed28449a18a8d1bd3090958fdc7be4 to your computer and use it in GitHub Desktop.
Java导出文件名含中文乱码解决
response.setContentType("text/plain; charset=UTF-8");
String encodedFileName = new String("中文".getBytes(), StandardCharsets.ISO_8859_1);
response.addHeader("Content-Disposition","attachment; filename=" + encodedFileName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment