I'm using Tomcat 4.1.29 on Windows.  I have a context setup which contains some 
image files (simple jpgs).  In the conf/server.xml file, the context looks 
something like:

 

<context path="photos" docBase="c:\photodirectory" debug="0" privileged="true" 
/>

 

Some of the filenames in this directory have non-English characters (e.g., 
ESPAÑA.jpg). 

 

For the associated website, I have some html pages which refer to these photos 
using an image tag that looks something like:

 

<img src=http://myhost/photos/ESPAÑA.jpg ...

 

The problem is that the photos with non-English characters aren't being 
displayed (it appears that Tomcat is unable to find them).  I thought URL 
Encoding the filename would fix the problem, but it doesn't.  Some of my 
experiments indicate that the browser (at least IE) will URL encode it anyway 
as it makes the request.  The html pages are being sent to the browser as utf-8.

 

As a test, I hardcoded the picture to be ESPANA.jpg in the html page and 
changed the filename in the file system.  Everything worked fine.  Photos that 
don't have non-English characters also work fine.  Unfortunately, the photos 
are constantly changing and so I don't have the option of simply renaming the 
files unless I find a way to do it that can automatically be applied to future 
files as well as the current ones.

 

My suspicion is that Tomcat isn't URL decoding the filename.

 

Does anyone have any insight into this problem or suggestions about the best 
way to fix the problem?

 

Scott 

 

 

Reply via email to