You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Madhav Bhargava <un...@gmail.com> on 2006/03/07 09:39:25 UTC

query parameters

Hi All,

It is a common practice to encode special characters such as ' ', %, #, :, $
etc.. when sending parameters in the query string along with the URL. We
have a similar requirement. Some of the query parameters can contain special
characters and therefore we went for UTf-8 encoding.

Before using the encoded parameters we call request.getParameter() in the
struts action class, decode these parameters and then do any further
processing. The problem comes when % is a part of the parameter value. For
instance the drugName parameter contains a value *pan% jon%. *This gets
encoded into *pan%25+jon%25*. The problem comes when we say
request.getParameter() in the action class. The value we get is already
decoded to *pan% jon%. *So now when we run the decoder it throws an
exception.

*How do i stop the automatic decoding of query parameters and do decoding of
all the query parameters explicitely? *


Madhav


--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do

Re: query parameters

Posted by Madhav Bhargava <un...@gmail.com>.
Yup i realised that as soon as sent this mail. Thanks for the reply.

On 3/7/06, David Delbecq <de...@oma.be> wrote:
>
> Encoding and decoding of query parameters is the job of container
> (tomcat, jboss, websphere, what ever you are using). The only struts
> related exception is for multipart/form-data (used for file uploads).
> There it's common-fileupload library which does the decoding. Why would
> you want to do the decoding yourself? The decoding/encoding process is
> done according to rfc1630 specifications.
>
> Madhav Bhargava a écrit :
>
> >Hi All,
> >
> >It is a common practice to encode special characters such as ' ', %, #,
> :, $
> >etc.. when sending parameters in the query string along with the URL. We
> >have a similar requirement. Some of the query parameters can contain
> special
> >characters and therefore we went for UTf-8 encoding.
> >
> >Before using the encoded parameters we call request.getParameter() in the
> >struts action class, decode these parameters and then do any further
> >processing. The problem comes when % is a part of the parameter value.
> For
> >instance the drugName parameter contains a value *pan% jon%. *This gets
> >encoded into *pan%25+jon%25*. The problem comes when we say
> >request.getParameter() in the action class. The value we get is already
> >decoded to *pan% jon%. *So now when we run the decoder it throws an
> >exception.
> >
> >*How do i stop the automatic decoding of query parameters and do decoding
> of
> >all the query parameters explicitely? *
> >
> >
> >Madhav
> >
> >
> >--
> >When I tell the truth, it is not for the sake of convincing those who do
> not
> >know it, but for the sake of defending those that do
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do

Re: query parameters

Posted by David Delbecq <de...@oma.be>.
Encoding and decoding of query parameters is the job of container
(tomcat, jboss, websphere, what ever you are using). The only struts
related exception is for multipart/form-data (used for file uploads).
There it's common-fileupload library which does the decoding. Why would
you want to do the decoding yourself? The decoding/encoding process is
done according to rfc1630 specifications.

Madhav Bhargava a écrit :

>Hi All,
>
>It is a common practice to encode special characters such as ' ', %, #, :, $
>etc.. when sending parameters in the query string along with the URL. We
>have a similar requirement. Some of the query parameters can contain special
>characters and therefore we went for UTf-8 encoding.
>
>Before using the encoded parameters we call request.getParameter() in the
>struts action class, decode these parameters and then do any further
>processing. The problem comes when % is a part of the parameter value. For
>instance the drugName parameter contains a value *pan% jon%. *This gets
>encoded into *pan%25+jon%25*. The problem comes when we say
>request.getParameter() in the action class. The value we get is already
>decoded to *pan% jon%. *So now when we run the decoder it throws an
>exception.
>
>*How do i stop the automatic decoding of query parameters and do decoding of
>all the query parameters explicitely? *
>
>
>Madhav
>
>
>--
>When I tell the truth, it is not for the sake of convincing those who do not
>know it, but for the sake of defending those that do
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org