I did a quick look at the struts2.2.1 source code.

It looks like the method [HttpServletRequest.setCharacterEncoding]
is invoked by class [FilterDispatcher] and [StrutsPrepareFilter].
(You can use [Call Hierarchy] view to find out this information)

In your old configuration, [StrutsPrepareFilter] is the last filter
applied to request, so the encoding set by this filter will
be used.

But in your new configuration, [StrutsPrepareFilter] is the first
filter applied to request, so the encoding set by this filter
could be overridden by other filters later.
In your case, it could be overridden by [SiteMeshFilter].

I suggest you to read source or docs of [SiteMeshFilter],
check out if it changed CharacterEncoding and how to change the
setting of it to use a correct encoding.



2010/10/18 Zoran Avtarovski <zo...@sparecreative.com>:
> I have a really strange character encoding error that is appearing when I
> attempt to change my struts2 filter configuration from:
>
>    <filter>
>        <filter-name>struts-cleanup</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-cla
> ss>
>    </filter>
>    <filter>
>        <filter-name>struts</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>    </filter>
>    <filter>
>        <filter-name>sitemesh</filter-name>
>
> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-cla
> ss>
>    </filter>
>
>    <filter-mapping>
>        <filter-name>struts-cleanup</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>    <filter-mapping>
>        <filter-name>sitemesh</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>    <filter-mapping>
>        <filter-name>struts</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
>
> To
>
>    <filter>
>        <filter-name>struts-prepare</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</f
> ilter-class>
>    </filter>
>
>    <filter>
>        <filter-name>sitemesh</filter-name>
>
> <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
>    </filter>
>
>    <filter>
>        <filter-name>struts-execute</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</f
> ilter-class>
>    </filter>
>
>    <filter-mapping>
>        <filter-name>struts-prepare</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
>    <filter-mapping>
>        <filter-name>sitemesh</filter-name>
>        <url-pattern>/*</url-pattern>
>        <dispatcher>REQUEST</dispatcher>
>        <dispatcher>FORWARD</dispatcher>
>        <dispatcher>INCLUDE</dispatcher>
>    </filter-mapping>
>
>    <filter-mapping>
>        <filter-name>struts-execute</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
>
> With only this change when I enter a 'æ' character (and e together) it
> appears a A!|! (garbage). Clearly there is a character encoding issue here.
> The whole app as well as Tomcat is encoded to UTF-8.
>
> What am I missing here. Please help!!!
>
> Z.
>

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

Reply via email to