You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Attila Király (JIRA)" <ji...@apache.org> on 2011/03/30 21:42:05 UTC

[jira] [Created] (WICKET-3578) Wicket should set the character encoding on requests

Wicket should set the character encoding on requests
----------------------------------------------------

                 Key: WICKET-3578
                 URL: https://issues.apache.org/jira/browse/WICKET-3578
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-core
    Affects Versions: 1.5-RC3
            Reporter: Attila Király


Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).

To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014026#comment-13014026 ] 

Martin Grigorov commented on WICKET-3578:
-----------------------------------------

Honestly, I'm not sure. 
If you can provide an application that shows the problem then I will try it.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-3578.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-RC4

Improved with r1096795.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>            Assignee: Martin Grigorov
>             Fix For: 1.5-RC4
>
>         Attachments: fix-WICKET-3578.patch, wicket-3578.zip
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov reassigned WICKET-3578:
---------------------------------------

    Assignee: Martin Grigorov

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>            Assignee: Martin Grigorov
>         Attachments: fix-WICKET-3578.patch, wicket-3578.zip
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014705#comment-13014705 ] 

Martin Grigorov commented on WICKET-3578:
-----------------------------------------

Yep, my approach will not work...

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch, wicket-3578.zip
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Attila Király (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13013630#comment-13013630 ] 

Attila Király commented on WICKET-3578:
---------------------------------------

How could that work? The container is doing the post parameter parsing based on the request encoding configured on the original request. Tomcat does not know about the wrappers.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Attila Király (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Király updated WICKET-3578:
----------------------------------

    Attachment: wicket-3578.zip

Attaching an example maven project showing the problem.

To reproduce:
1. Compile and deploy the app in Tomcat (I used 7.0.11 but 6.x should do it too).
2. Go to http://localhost:8080/wicket-3578/ (any browser is good): you should see a text input field with a "€" in it.
3. Without modifying anything just submit the form. In the reloaded page you should see a corrupted value in the field (something like "€" which is the ISO-8859-1 decoded value of the UTF-8 encoded "€").

Now if you uncomment in the web.xml the url-mapping for the "encodingFilter" and repeat the test you should see the problem gone.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch, wicket-3578.zip
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Attila Király (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014760#comment-13014760 ] 

Attila Király commented on WICKET-3578:
---------------------------------------

An alternative solution could be to implement this in the WicketFilter directly: it could be off by default and turned on with a filter init-param in web.xml.

Btw. I found an interesting info in the javadoc of o.a.w.settings.IRequestCycleSettings.getResponseRequestEncoding():
"wicket now uses multipart/form-data for it's forms"
This explains why this was not a problem in the past: multipart requests are parsed by wicket (with the correct encoding) and not by the container. However wicket is not using "multipart/form-data" for every form now: neither in 1.4 nor in 1.5.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch, wicket-3578.zip
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13013616#comment-13013616 ] 

Martin Grigorov commented on WICKET-3578:
-----------------------------------------

I think Wicket should use HttpServletRequestWrapper and should not set any settings to the original HttpServlerRequest.
We can use the new AbstractRequestWrapperFactory/FilterFactoryManager for this.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-3578) Wicket should set the character encoding on requests

Posted by "Attila Király (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Király updated WICKET-3578:
----------------------------------

    Attachment: fix-WICKET-3578.patch

Attaching suggested patch. Tests pass.

> Wicket should set the character encoding on requests
> ----------------------------------------------------
>
>                 Key: WICKET-3578
>                 URL: https://issues.apache.org/jira/browse/WICKET-3578
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 1.5-RC3
>            Reporter: Attila Király
>         Attachments: fix-WICKET-3578.patch
>
>
> Browsers should but actually do not send encoding information with requests. Because of this servlet containers (like Tomcat) use the default "ISO-8859-1" encoding to decode POST parameters in non-multipart requests. This is wrong in case the webapp is using a different encoding (like UTF-8).
> To workaround this it is possible to specify the correct encoding on the server side trough javax.servlet.ServletRequest.setCharacterEncoding(String). This can be done in a filter (I use spring's CharacterEncodingFilter for this, but Tomcat also has SetCharacterEncodingFilter for the same). It would be nice if wicket could do this out of box so no additional filter would be needed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira