You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (Jira)" <ji...@apache.org> on 2022/06/16 09:09:00 UTC

[jira] [Closed] (WW-2361) the default request charEncoding always used.

     [ https://issues.apache.org/jira/browse/WW-2361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart closed WW-2361.
-----------------------------
    Fix Version/s:     (was: 6.1.0)
       Resolution: Won't Do

> the default request charEncoding always used.
> ---------------------------------------------
>
>                 Key: WW-2361
>                 URL: https://issues.apache.org/jira/browse/WW-2361
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.0.11
>            Reporter: Avatar Zhang
>            Priority: Major
>
> // SUGGESTION
> Index: Dispatcher.java
> ===================================================================
> --- Dispatcher.java	(revision 602010)
> +++ Dispatcher.java	(working copy)
> @@ -620,10 +620,16 @@
>          }
>  
>          if (encoding != null) {
> -            try {
> -                request.setCharacterEncoding(encoding);
> -            } catch (Exception e) {
> -                LOG.error("Error setting character encoding to '" + encoding + "' - ignoring.", e);
> +            String encoding2 = request.getCharacterEncoding();
> +            if (encoding2 == null) {
> +                try {
> +                    request.setCharacterEncoding(encoding);
> +                    LOG.info("Set Character Encoding to " + encoding + "!");
> +                } catch (Exception e) {
> +                    LOG.error("Error setting character encoding to '" + encoding + "' - ignoring.", e);
> +                }
> +            } else {
> +                LOG.info("Character Encoding is " + encoding2 + ".");
>              }
>          }
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)