You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Davide Maestroni (JIRA)" <ji...@apache.org> on 2010/11/22 18:48:14 UTC
[jira] Resolved: (SLING-1879) Wrong re-encoding of request
parameter values
[ https://issues.apache.org/jira/browse/SLING-1879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Davide Maestroni resolved SLING-1879.
-------------------------------------
Resolution: Not A Problem
The encoding is set through the _charset_ parameter, anyway I would expect that the encoding set in the Content-Type header is used when _charset_ is missing, and not an arbitrary value chosen just because it is the common case.
> Wrong re-encoding of request parameter values
> ---------------------------------------------
>
> Key: SLING-1879
> URL: https://issues.apache.org/jira/browse/SLING-1879
> Project: Sling
> Issue Type: Bug
> Components: Engine
> Affects Versions: Engine 2.1.0
> Reporter: Davide Maestroni
> Priority: Critical
>
> When the request character encoding is different from the sling servlet default, i.e. ISO-8859-1, the request parameter values are wrongly re-encoded.
> In fact, in case the request encoding is UTF-8 and one of the parameter values is "Orlèans", when ContainerRequestParameter.setEncoding() is called, the value is first encoded into bytes using UTF-8 and then the same bytes are passed to the new string with the ISO-8859-1 encoding. Thus what is effectively done is:
> this.value = new String("Orlèans".getBytes("UTF-8"), "ISO-8859-1")
> The resulting value is obviously wrong: "Orlèans".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Resolved: (SLING-1879) Wrong re-encoding of request
parameter values
Posted by Felix Meschberger <fm...@gmail.com>.
Hi,
Am Montag, den 22.11.2010, 12:48 -0500 schrieb Davide Maestroni (JIRA):
> [ https://issues.apache.org/jira/browse/SLING-1879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Davide Maestroni resolved SLING-1879.
> -------------------------------------
>
> Resolution: Not A Problem
>
> The encoding is set through the _charset_ parameter, anyway I would expect that the encoding set in the Content-Type header is used when _charset_ is missing, and not an arbitrary value chosen just because it is the common case.
AFAICT we in fact use the getCharacterEncoding method to try to find out
the character encoding used by the client. Unfortunately, clients
(browsers mostly) generally don't send this information, so we had to
revert to the _charset_ request parameter.
Out general recommendation is to (1) send the form in an UTF-8 encoded
response, to (2) set the _charset_ hidden form field to UTF-8 and (3) to
use multipart/form-data POST requests to send back the form. This shows
to provide the most stable character encoding support.
Regards
Felix
>
> > Wrong re-encoding of request parameter values
> > ---------------------------------------------
> >
> > Key: SLING-1879
> > URL: https://issues.apache.org/jira/browse/SLING-1879
> > Project: Sling
> > Issue Type: Bug
> > Components: Engine
> > Affects Versions: Engine 2.1.0
> > Reporter: Davide Maestroni
> > Priority: Critical
> >
> > When the request character encoding is different from the sling servlet default, i.e. ISO-8859-1, the request parameter values are wrongly re-encoded.
> > In fact, in case the request encoding is UTF-8 and one of the parameter values is "Orlèans", when ContainerRequestParameter.setEncoding() is called, the value is first encoded into bytes using UTF-8 and then the same bytes are passed to the new string with the ISO-8859-1 encoding. Thus what is effectively done is:
> > this.value = new String("Orlèans".getBytes("UTF-8"), "ISO-8859-1")
> > The resulting value is obviously wrong: "Orlèans".
>