You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thomas Peter Berntsen <tp...@gmail.com> on 2007/03/19 17:37:50 UTC
Requesting files with non-English/international characters in their names
Hi guys,
I have some trouble getting Tomcat to return files with
non-English/international characters in their names.
Eg. I have two files in the root app (the standard app in the ROOT folder),
one named " tomcat.gif" and another one, which is a copy of "tomcat.gif",
named "æøå.gif". When I request "tomcat.gif" using the address
"http://localhost:8080/tomcat.gif
", all is fine. The image is shown correctly.
But when I request the other one, using "http://localhost:8080/æøå.gif" I
get an error 404 along with a description: "description The requested
resource (/%C3%A6%C3%B8%C3%A5.gif) is not available." This should be fine,
as Tomcat converts it to UTF-8.
If I put the two files into a separate directory, eg. "test" and access the
directory like "http://localhost:8080/test", I get a directory listing. All
good, except that the file " æøå.gif" doesn't display correctly. The
characters in the file name are not displayed correctly, and a click on the
file returns another error 404.
I am running Apache 5.0.x and 5.5.x on Suse Linux 10.x. I can verify that
the errors should have nothing to do with file permissions or browser
errors. I can open the file " æøå.gif" with a standard image viewer.
I have tried setting 'URIEncoding="UTF-8"' in the port 8080 connector, but
without success.
What do I do?
Cheers,
Thomas
Re: Requesting files with non-English/international characters in their names
Posted by Thomas Peter Berntsen <tp...@gmail.com>.
Dear Mark,
Thanks for your reply. I've commented below.
On 3/25/07, Mark Thomas <ma...@apache.org> wrote:
> Thomas Peter Berntsen wrote:
> > I have some trouble getting Tomcat to return files with
> > non-English/international characters in their names.
>
> The good news is that this works for me. Now all we need to do is
> figure out why it doesn't for you ;)
>
Yay :-)
> > But when I request the other one, using "http://localhost:8080/æøå.gif" I
> > get an error 404 along with a description: "description The requested
> > resource (/%C3%A6%C3%B8%C3%A5.gif) is not available." This should be fine,
> > as Tomcat converts it to UTF-8.
>
> Directory listings worked for UTF-8 files out of the box for me
> although I got a 503 rather than a 404 trying to access the files.
>
> Once I set URIEncoding="UTF-8" in the connector, I could access the
> files without any problems. I haven't tested 5.0.x.
>
> With URIEncoding="UTF-8" everything worked in both Windows and Linux.
>
Here, things work in my custom JSP pages when focusing on GETs in
forms. But the mechanics behind directory listings and direct file
requests seems to disregard my attempts to commandeer Tomcat in the
direction of UTF-8.
> > If I put the two files into a separate directory, eg. "test" and access the
> > directory like "http://localhost:8080/test", I get a directory listing.
>
> OK. This is the first thing to fix. get this working and then worry
> about accessing the file.
>
OK.
> > I am running Apache 5.0.x and 5.5.x on Suse Linux 10.x. I can verify that
> > the errors should have nothing to do with file permissions or browser
> > errors. I can open the file " æøå.gif" with a standard image viewer.
>
> Which versions? Looking at the svn history for the default servlet it
> looks like the fix for 40901 had some positive unintended
> consequences. This fix is in 5.5.21 onwards.
>
I'm trying with Tomcat 5.0.30 (standard in this Suse version) and
5.5.20. I'll have to try with the 5.5.21.
> > I have tried setting 'URIEncoding="UTF-8"' in the port 8080 connector, but
> > without success.
>
> You'll need this once directory listings are working.
>
> > What do I do?
>
> Hopefully an upgrade to 5.5.21 will fix this.
>
OK - I'll have a look at it. :-)
> Mark
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Requesting files with non-English/international characters in
their names
Posted by Mark Thomas <ma...@apache.org>.
Thomas Peter Berntsen wrote:
> I have some trouble getting Tomcat to return files with
> non-English/international characters in their names.
The good news is that this works for me. Now all we need to do is
figure out why it doesn't for you ;)
> But when I request the other one, using "http://localhost:8080/æøå.gif" I
> get an error 404 along with a description: "description The requested
> resource (/%C3%A6%C3%B8%C3%A5.gif) is not available." This should be fine,
> as Tomcat converts it to UTF-8.
Directory listings worked for UTF-8 files out of the box for me
although I got a 503 rather than a 404 trying to access the files.
Once I set URIEncoding="UTF-8" in the connector, I could access the
files without any problems. I haven't tested 5.0.x.
With URIEncoding="UTF-8" everything worked in both Windows and Linux.
> If I put the two files into a separate directory, eg. "test" and access the
> directory like "http://localhost:8080/test", I get a directory listing.
OK. This is the first thing to fix. get this working and then worry
about accessing the file.
> I am running Apache 5.0.x and 5.5.x on Suse Linux 10.x. I can verify that
> the errors should have nothing to do with file permissions or browser
> errors. I can open the file " æøå.gif" with a standard image viewer.
Which versions? Looking at the svn history for the default servlet it
looks like the fix for 40901 had some positive unintended
consequences. This fix is in 5.5.21 onwards.
> I have tried setting 'URIEncoding="UTF-8"' in the port 8080 connector, but
> without success.
You'll need this once directory listings are working.
> What do I do?
Hopefully an upgrade to 5.5.21 will fix this.
Mark
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Requesting files with non-English/international characters in
their names
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thomas,
Thomas Peter Berntsen wrote:
> I have some trouble getting Tomcat to return files with
> non-English/international characters in their names.
It's interesting how questions like this come in waves.
> I have tried setting 'URIEncoding="UTF-8"' in the port 8080 connector,
> but without success.
Are you serving your pages in UTF-8 encoding? Usually, the browser uses
the response encoding from the previous request to submit the next
request's URI. If you are using ISO-8859-1 for your web pages, then
expecting the browser to use UTF-8 for the URIs in incorrect.
Basically, you have to make sure that everything is using UTF-8, and it
should all start to work. If you are missing one piece of the puzzle,
you can always find something that doesn't work.
Check:
- - Your web page response encoding.
- - Any forms with overridden encoding.
- - Your <Connector> (which you already mentioned).
... and make sure that everything is using UTF-8. Next, verify that it
is set up properly by requesting a page and then examining the request
using your browser. I believe that most popular browsers today will
display the character encoding being used to render the page if you view
the "page properties" or whatever the proper term is in your browser.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF/sCC9CaO5/Lv0PARAtXUAJ9J8Osxwy8dgcKg5jUwO0w61njD7gCcCi6t
BQ52LhpMAT2lS68smdnbPlQ=
=E1Wy
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org