try converting the filename to ISO-8859-1 as well
eg filename = new String(file.getName(), ISO-8859-1);
Your Code (modified):
response.setHeader(Content-Disposition, attachment; filename= +
new String(file.getName(), ISO-8859-1));
response.setContentLength((int)file.length());
response.setContentType(application/octet-stream);
response.setHeader(Content-Transfer-Encoding, binary);
Hope that helps.
John Sidney-Woollett
Andreas Hartstack said:
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
_
Schützen Sie Ihren Posteingang vor unerwünschten E-Mails.
http://www.msn.de/antispam/prevention/junkmailfilter Jetzt
Hotmail-Junk-Filter aktivieren!
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]