apache2/mod_jk/tomcat4 - downloading files with special characters in the filename

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top