tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Harper" <rob...@iat-cti.com>
Subject RE: Problems serving files to download
Date Tue, 28 Jun 2005 14:11:59 GMT
Try the following if you are trying to read the following in a servlet:

String s = java.net.URLDecoder.decode(
"http://localhost/tomcat-docs/acentua%C3%A7%C3%A3o.txt", "UTF-8" );

You can read the file and write it out to the response stream. Since this is
a text file it will be displayed in the browser window. The user may then
save the file from the browser. 

Robert S. Harper
Information Access Technology, Inc.

-----Original Message-----
From: Roberto Rios [mailto:roberto.rios@innovaction.com.br] 
Sent: Tuesday, June 28, 2005 7:49 AM
To: 'Tomcat Users List'
Subject: Problems serving files to download

Hi,
 
I have a tomcat 4.1.31 (j2sdk1.4.2_08) running in a linux rh9 box. It's
a fresh install.
 
I'm from Brazil, so I've configured my linux to use pt_BR.ISO-8859-1. If
I type locale, everything is ok.
 
My CATALINA_OPTS has the "-Dfile.encoding=ISO-8859-1"
 
I have no problems with my applications. Everithing works fine. All my
pages are compiled fine, my servlets work fine, etc...
 
But, if I try to serve files to download, and this files had special
characters like çãí....etc, when I click the file name (that is
displayed right), I receive the 404 HTTP error.
 
For instance: using vi, I created a file named "acentuação.txt" inside
the tomcat-docs directory. When I try to access this file, it's name is
encoded to "acentua%C3%A7%C3%A3o.txt" (the address shows
<http://localhost/tomcat-docs/acentua%C3%A7%C3%A3o.txt>
http://localhost/tomcat-docs/acentua%C3%A7%C3%A3o.txt), and after that I
can't access it. I tryed to use Firefox (1.0.4) and IE 6, but I got the
same problem
 
How do I manage this? Who encoded the name?
 
TIA,
 
Bob



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message