Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > apache2/mod_jk/tomcat4 - downloading files with special characters in the filename

Reply
Thread Tools

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

 
 
Andreas
Guest
Posts: n/a
 
      03-02-2004
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. "tst.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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with special characters in filename fizzotti@gmail.com Python 2 01-23-2009 10:12 AM
Remove only special characters and junk characters from a file rvino Perl 0 08-14-2007 07:23 AM
Re: Meta-Characters, Special Characters xah@xahlee.org Java 2 05-31-2007 09:25 AM
Stitch rar files ( filename.part01 and filename.part02) Please help ixgor Software 1 10-15-2006 02:33 AM
How to convert HTML special characters to the real characters with a Java script Stefan Mueller HTML 3 07-23-2006 10:09 PM



Advertisments