On 3/22/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas,

Thomas Peter Berntsen wrote:
>> 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.
>
> Thanks. I'll check that. But isn't that irrelevant in the case that I
> just request a directory listing through a URL like:
> "localhost:8080/test"? Or irrelevant in the case I request a file
> directly through a URL like: "localhost:8080/æøå.gif"?

Since the server doesn't know for sure what encoding is being used by
the browser, it certainly does make a difference. If the browser uses
the encoding from the last response, then the encoding from the last
response is certainly relevant.
Yes, absolutely.

If you cold-call the server with a URL, the server does not know what
encoding to use. I believe that Tomcat's default is ISO-8859-1 (as
inferred from
http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/index.html,
which points out the use of URIEncoding in the <Connector>), in spite of
the W3C's recommendation to use UTF-8
(http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars).

Yes, my perception is also that ISO-8859-1 is Tomcat's default encoding.
> Just to be sure I edited the index.jsp of the ROOT app in which I have
> created the "æøå.gif" file and changed the encoding to UTF-8, but with
> no different result.

Hmm... and did you still have URIEncoding="UTF-8" set in your
<Connector>? Also, make sure that it's the right connector... Tomcat's
default config file has a bunch of connectors that are commented-out.

Yup, and that's the funky part about it. I have tried many things:
- I have added the URIEncoding="UTF-8" to the correct connector (I
verified that it is the correct one by commenting it out).
- I have even changed the default directory listing to use an external
XSL file (http://tomcat.apache.org/tomcat-5.0-doc/default-servlet.html),
in which I have specified UTF-8 as encoding almost everywhere.

...And also doing the opposite  - specifying ISO-8859-1 everywhere I
could, also explicitly in the connector through
URIEncoding="ISO-8859-1"

I can verify that a sample JSP file that I have created works as
expected when the encoding is changed between UTF-8 and ISO-8859-1 in
the connector and in the page. And, as you mention, once UTF is
specified in the connector and the page, things work nicely with JSPs
(characters display correctly and corresponding to encoding chosen in
the browser and text within the JSP page.

But, unfortunately it doesn't have an impact on directory listings or
direct file access. As mentioned, I have tried running Tomcat
completely in UTF-8 and ISO-8859-1 mode to avoid mixups of encodings,
but without a different result.

However I noticed that the question marks, which display instead of
the expected characters in the directory listing, show up in my text
editor when displaying ISO-8859-1 encoded text as UTF-8. Then I
noticed that the encoding reported by my browser for the page showing
the directory listing is actually UTF-8, no matter what I attempt to
specify in the XSL, web.xml, connectors etc.

I also forced the external XSL file to render the directory listing as
XML instead of HTML, with ISO-8859-1 and UTF-8, respectively, but even
though the resulting page contained an explicit declaration that the
content is ISO-8859-1, my browser still reports it to be UTF-8.

I have no clue anymore. Could it be that somehow there is a deeper
cause than just what parameters can change and tuned? Something in the
source code that converts characters in the file names of files in the
file system to a UTF-8 representation of ISO-8859-1 characters?

Perhaps that's a little over the top but so is this issue :-(

Thanks for your help - it's greatly appreciated.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGAbN09CaO5/Lv0PARAu9pAJwNwi3G/2j/P+ygJqjiHE0lj4IjAwCgiPgm
b3KRLBeQc0h7E9b5SDyQPa8=
=26jP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to