Reputation: 135
In my project code I can see FilterDispatcher
being extended to set the default encoding as "UTF-8". My question is there any other better way we can do the same or this is the best way.
PS: The initial development was done in a country on Non-English windows PCs.
Upvotes: 1
Views: 256
Reputation: 24396
Actually there is struts.i18n.encoding
constant which sets default locale and encoding scheme. You can set it in struts.properties
file:
struts.i18n.encoding=UTF-8
or in struts.xml
file:
<constant name="struts.i18n.encoding" value="UTF-8" />
BTW: struts.i18n.encoding
should be set to UTF-8
by default in Struts2 anyway.
BTW no.2: FilterDispatcher
is deprecated since Struts 2.1.3. So if you using version higher than that use StrutsPrepareAndExecuteFilter
instead.
Upvotes: 2