tomcat-users mailing list archives

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

Mircea,

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: http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q8

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: http://www.webtoolkit.info/javascript-utf8.html).
> 	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
alert(scriptBuiltUrl); 
> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvPUiAACgkQ9CaO5/Lv0PCzgACeO2s4vDa1XqpBV31qwsHIxdMU
uGgAnRHx64NOG/7RPky13Pq5ErwA+xiW
=Xc4I
-----END PGP SIGNATURE-----

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


Mime
View raw message