tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: UTF-8 encoding in Tomcat 6.0
Date Wed, 21 Apr 2010 19:29:36 GMT
Hash: SHA1


On 4/21/2010 2:46 PM, Mircea LUTIC wrote:
> 	1. If the filter does not influence the decoding of the GET  parameters why is it called
on GET requests? 

Because you have mostly likely configured it to be invoked when a GET
request is processed. Tomcat doesn't have any idea what your filter
does: it just calls it whenever appropriate (where the definition of
"appropriate" is based upon your configuration in web.xml).

> 	2. How about http : PUT, HEAD, etc?

It will be called for all HTTP methods unless you configure it to be
called otherwise.

> 	3. I did what this page says:

That's a good start, but it won't solve all your HTTP GET problems
because you simply cannot control what the client does with the
parameter encoding. It's always better to use HTTP POST when sending
non-US-ASCII-encoded text.

> What if I want to build a fully UTF-8 application that will be posted on a web hosting
provider where I have no access to server.xml (because this is a common file)?

You'll have to either ask your ISP what URIEncoding they use (and hope
they use UTF-8) or use HTTP POST instead of HTTP GET.

> 	4. I didn't sniff the wire - I only had a look at the  URL I send with the javascript
alert function.

Sniffing the wire would be a good thing to do: you'll see what the
encoding looks like on the way from the client to the server.

> 	5. "Utf8encode" converts Unicode strings to strings of bytes in UTF-8 encoding
> (see here:
> 	6. "escape" (a standard script function) converts characters not acceptable for http
(like slashes) 
> to the %XX  notation. 
> 	7. Combined escape(Utf8encode("larevoluție"))="larevolu%C8%9Bie"

Okay. Have you confirmed that the server is getting the encoded URL the
way you think it should be encoded?

> 	8. POST is not really an acceptable solution because I don't know in advance what the
keys of the request will be ("Name" in 
> the example) neither how many they are & POST requires using a html <form>.

Yes, on a web page, POST requires using a <FORM>. What's wrong with
that? I'm not sure I understand what you mean when you say you don't
know in advance what the keys of the request will be.

> (what I do is build an  
> URL in javascript/emacscript from a structured object returned by showModalDialog then
> window.location=scriptBuiltUrl;
> ).

If you are using javascript to send the data to the server, I would
think that switching from GET to POST would be trivial.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message