Skip to content

Instantly share code, notes, and snippets.

@seco
Created October 1, 2019 22:12
Show Gist options
  • Save seco/4655c5a31fc1a46d91d6e5f46459f522 to your computer and use it in GitHub Desktop.
Save seco/4655c5a31fc1a46d91d6e5f46459f522 to your computer and use it in GitHub Desktop.
if (header.contains("MSIE") || header.contains("Trident")) {
fileName = URLEncoder.encode(fileName,"UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ";");
} else {
fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment