A
Andreas
Problem:
In my tomcat webapp a servlet manages a filedownload. Clicking on a
file-link results in the browser's
"save as" dialog.
Using tomcat alone (port 8080) everything works fine. Special
characters (like German umlaut) are shown
in ISO-8859-1.
Apache2/mod_jk seems to change the charset to UTF-8, e.g. "täst.txt"
looks like "tät.txt".
Code:
response.setHeader("Content-Disposition", "attachment; filename=" +
file.getName());
response.setContentLength((int)file.length());
response.setContentType("application/octet-stream");
response.setHeader("Content-Transfer-Encoding", "binary");
I tried also:
response.setContentType("application/octet-stream;
charset=ISO-8859-1");
or
String tmpName = new String(f.getName().getBytes(),"ISO-8859-1");
response.setHeader("Content-Disposition", "attachment;
charset=ISO8859-1; filename="+tmpName);
or
response.setHeader("Content-Transfer-Encoding", "ISO-8859-1");
Configuration:
- Suse 8.2
- Apache2.0.48
- Tomcat4.1.18
- mod_jk
- $tomcat_home/bin/catalina.sh:
export CATALINA_OPTS="-Dfile.encoding=ISO-8859-1 -Duser.language=de
-Duser.country=DE"
Who can help ? Thank's in advance !
Andreas
In my tomcat webapp a servlet manages a filedownload. Clicking on a
file-link results in the browser's
"save as" dialog.
Using tomcat alone (port 8080) everything works fine. Special
characters (like German umlaut) are shown
in ISO-8859-1.
Apache2/mod_jk seems to change the charset to UTF-8, e.g. "täst.txt"
looks like "tät.txt".
Code:
response.setHeader("Content-Disposition", "attachment; filename=" +
file.getName());
response.setContentLength((int)file.length());
response.setContentType("application/octet-stream");
response.setHeader("Content-Transfer-Encoding", "binary");
I tried also:
response.setContentType("application/octet-stream;
charset=ISO-8859-1");
or
String tmpName = new String(f.getName().getBytes(),"ISO-8859-1");
response.setHeader("Content-Disposition", "attachment;
charset=ISO8859-1; filename="+tmpName);
or
response.setHeader("Content-Transfer-Encoding", "ISO-8859-1");
Configuration:
- Suse 8.2
- Apache2.0.48
- Tomcat4.1.18
- mod_jk
- $tomcat_home/bin/catalina.sh:
export CATALINA_OPTS="-Dfile.encoding=ISO-8859-1 -Duser.language=de
-Duser.country=DE"
Who can help ? Thank's in advance !
Andreas