-----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. 

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

>       7. Combined escape(Utf8encode("larevoluție"))="larevolu%C8%9Bie"
>       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>.
> (what I do is build an  
> URL in javascript/emacscript from a structured object returned by 
> showModalDialog then alert(scriptBuiltUrl); 
> window.location=scriptBuiltUrl;
> ). Thank you for your help.
> Mircea
> 
> 
> 
> 
> 
> ________________________________
> From: Christopher Schultz <ch...@christopherschultz.net>
> To: Tomcat Users List <users@tomcat.apache.org>
> Sent: Wed, 21 April, 2010 18:43:21
> Subject: Re: UTF-8 encoding in Tomcat 6.0
> 
> Mircea,
> 
> On 4/21/2010 6:56 AM, Mircea LUTIC wrote:
>> The filter does get called on my GET request.
> 
> Of course.
> 
>> In my understanding, a filter is the reccomended method of handling
>> UTF-8 for both GET & POST (as well as other methods like HEAD, PUT
>> etc.).
> 
> The filter cannot influence the way that GET parameters are decoded. The
> only way to change that is to set URIEncoding="UTF-8" on your
> <Connector> in server.xml.
> 
> Your best bet is to transfer all non-US-ASCII data in request /bodies/
> by using HTTP POST.
> 
> If HTTP POST is not acceptable, please let us know why and perhaps we
> can suggest some alternatives.
> 
> This looks a bit weird to me:
>>    
>> window.location="test.jsp?Name=larevolu%C8%9Bie";//"test.jsp?Name="+escape(Utf8encode("larevoluție"))
> 
> What does the Utf8encode function do? What does the escape function do?
> 
> Have you tried snooping the HTTP conversation using a browser plug-in
> and/or a line sniffer like Wireshark? What does the data doing over the
> TCP/IP connection look like?
> 
> -chris

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



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

iEYEARECAAYFAkvPUkMACgkQ9CaO5/Lv0PDhHQCgjgtY7redg8MkBOAdw5krikRH
5DAAoKehO35ziv8nxOBtTQBJojpHComd
=Pl8T
-----END PGP SIGNATURE-----

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

Reply via email to