Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: URIEncoding

Frederic Bastian

2007-07-26

Replies:

Hi Pulkit, thanks for your answer.

The matter is that Tomcat won't get the correct values of the parameters
in the URL. For instance :

If my URI looks like : http://host/?query=%C3%A9%C3%A8
The URI encoding is UTF-8

By default, Tomcat will read this url in ISO-8859-1. So
HttpServletRequest.getParameter("query") will return an incorrect value.
The solution you proposed won't help Tomcat to return a correct value
with the "getParameter" method.

If I add into server.xml the attribut URIEncoding="UTF-8" to the
Connector, Tomcat will correctly read the "query" parameter.
I would like Tomcat to read correctly URL in UTF-8, but without
modifying server.xml.

Any suggestion ?

Pulkit Singhal a ?crit :
> Hi Frederic,
>
> I don't know about HttpSession.<method> for settign the URIEncoding.
> But you could always do somethign along the lines of:
> String uri_utf8 = new String (uri.getBytes("iso-8859-1"), "UTF-8");
> inside the application.
>
> On 7/26/07, Frederic Bastian <Frederic.Bastian@(protected):
>>
>> Hi folks :)
>>
>>
>> I need my URI to be in UTF-8. In server.xml, I added to the Connector
>> the attribut : URIEncoding="UTF-8"
>> This works well. But my question is :
>>
>> Is there a way to define the URIEncoding in the application itself ?
>>
>> For instance, you can modify the session timeout in the application
>> itself (HttpSession.setMaxInactiveInterval()). I would like to modify
>> the URIEncoding by the same way.
>>
>> Would anyone know how to achieve that ?
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@(protected)
>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>> For additional commands, e-mail: users-help@(protected)
>>
>>
>

--
Frederic Bastian, PhD student
Department of Ecology and Evolution
Biophore, University of Lausanne, 1015 Lausanne, Switzerland.
tel: +41 21 692 4221
http://www.unil.ch/dee/page22707.html

Swiss Institute of Bioinformatics
http://www.isb-sib.ch/


---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.