You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by MORÁVEK Peter <mo...@pobox.sk> on 2001/01/15 17:39:12 UTC

request taglib and parameters encoding

Hello,

when I use the <request:get-parameter ...> tag to retrieve client entered
value with slovak characters (not ISO-8859-1), 
I become instead of the characters just question mark characters '?'. I know
that I it so because the servlet engine (I use JRun 3.0) don't use the right
encoding to retrieve data from the stream.

The only way I can retrieve the right data from the request is to do the
character conversion:

String encoding = "Cp1250";
String incorrect = request.getParameter("name");
String correct = new String(incorrect.getBytes(), newEncoding);

Does anybody already patched the request tag library to support different
encodings so I don't have to do it on my self and later replace it with
default behaviour of the cocoon.

Thanks in advance

Peter

Re: request taglib and parameters encoding

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 15 Jan 2001, [iso-8859-1] MOR�VEK Peter wrote:

> when I use the <request:get-parameter ...> tag to retrieve client entered
> value with slovak characters (not ISO-8859-1),
> I become instead of the characters just question mark characters '?'. I know
> that I it so because the servlet engine (I use JRun 3.0) don't use the right
> encoding to retrieve data from the stream.
>
> The only way I can retrieve the right data from the request is to do the
> character conversion:
>
> String encoding = "Cp1250";
> String incorrect = request.getParameter("name");
> String correct = new String(incorrect.getBytes(), newEncoding);
>
> Does anybody already patched the request tag library to support different
> encodings so I don't have to do it on my self and later replace it with
> default behaviour of the cocoon.

it doesn't seem like you want to patch the request library here, since the
encoding change routine is something you might want to do to any string.
how about a new namespace:

<encoding:convert>
  <encoding:to>Cp1250</encoding:to>
  <request:get-parameter name="name"/>
</encoding:convert>

to make it more succinct, you could have a top-level default to encoding:

<encoding:to type="default">Cp1250</encoding:to>

- donald


Re: request taglib and parameters encoding

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 15 Jan 2001, [iso-8859-1] MOR�VEK Peter wrote:

> when I use the <request:get-parameter ...> tag to retrieve client entered
> value with slovak characters (not ISO-8859-1),
> I become instead of the characters just question mark characters '?'. I know
> that I it so because the servlet engine (I use JRun 3.0) don't use the right
> encoding to retrieve data from the stream.
>
> The only way I can retrieve the right data from the request is to do the
> character conversion:
>
> String encoding = "Cp1250";
> String incorrect = request.getParameter("name");
> String correct = new String(incorrect.getBytes(), newEncoding);
>
> Does anybody already patched the request tag library to support different
> encodings so I don't have to do it on my self and later replace it with
> default behaviour of the cocoon.

it doesn't seem like you want to patch the request library here, since the
encoding change routine is something you might want to do to any string.
how about a new namespace:

<encoding:convert>
  <encoding:to>Cp1250</encoding:to>
  <request:get-parameter name="name"/>
</encoding:convert>

to make it more succinct, you could have a top-level default to encoding:

<encoding:to type="default">Cp1250</encoding:to>

- donald