You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonny Cavell <jo...@gmail.com> on 2007/12/29 17:23:01 UTC
Character encoding problems with Struts 2 and Freemarker or
Velocity
I am setting default_encoding=UTF-8 in freemarker.properties, and leaving the
struts encoding in default.properties untouched (i.e.
struts.i18n.encoding=UTF-8). When I use a struts action to forward to a test
page with Spanish text, without specifying the type (thus defaulting to
jsp), it outputs fine. However, if the action forwards to the same page, but
specifying the type as freemarker, the output is garbled. It is also garbled
for Velocity, making me think that the problem must lie somewhere within
Struts 2.
Even if I subclass FreemarkerManager, override the createConfiguration
method and explicitly call config.setDefaultEncoding("utf-8") here, and
specify this class as the struts.freemarker.manager.classname in
struts.properties, it makes no difference - the output is garbled.
Does anybody know why this might be the case?
Thanks
Jonny
--
View this message in context: http://www.nabble.com/Character-encoding-problems-with-Struts-2-and-Freemarker-or-Velocity-tp14538951p14538951.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Character encoding problems with Struts 2 and Freemarker or
Velocity
Posted by Jonny Cavell <jo...@gmail.com>.
Thanks a lot, that has sorted it out.
I'm a bit confused as to why changing the default from utf-8 works though...
Jonny Cavell wrote:
>
> I am setting default_encoding=UTF-8 in freemarker.properties, and leaving
> the struts encoding in default.properties untouched (i.e.
> struts.i18n.encoding=UTF-8). When I use a struts action to forward to a
> test page with Spanish text, without specifying the type (thus defaulting
> to jsp), it outputs fine. However, if the action forwards to the same
> page, but specifying the type as freemarker, the output is garbled. It is
> also garbled for Velocity, making me think that the problem must lie
> somewhere within Struts 2.
>
> Even if I subclass FreemarkerManager, override the createConfiguration
> method and explicitly call config.setDefaultEncoding("utf-8") here, and
> specify this class as the struts.freemarker.manager.classname in
> struts.properties, it makes no difference - the output is garbled.
>
> Does anybody know why this might be the case?
>
> Thanks
>
> Jonny
>
>
--
View this message in context: http://www.nabble.com/Character-encoding-problems-with-Struts-2-and-Freemarker-or-Velocity-tp14538951p14575550.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Character encoding problems with Struts 2 and Freemarker or
Velocity
Posted by Martin Gainty <mg...@hotmail.com>.
http://www.opensymphony.com/webwork/wikidocs/WebWork%20Freemarker%20Support.html
default-encoding needs to be set to ISO-8859-1 in freemarker.properties
more specifically:
default_encoding=ISO-8859-1 template_update_delay=5 locale=no_NO HTHMartin______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Date: Sat, 29 Dec 2007 08:23:01 -0800> From: jonny.cavell@gmail.com> To: user@struts.apache.org> Subject: Character encoding problems with Struts 2 and Freemarker or Velocity> > > I am setting default_encoding=UTF-8 in freemarker.properties, and leaving the> struts encoding in default.properties untouched (i.e.> struts.i18n.encoding=UTF-8). When I use a struts action to forward to a test> page with Spanish text, without specifying the type (thus defaulting to> jsp), it outputs fine. However, if the action forwards to the same page, but> specifying the type as freemarker, the output is garbled. It is also garbled> for Velocity, making me think that the problem must lie somewhere within> Struts 2.> > Even if I subclass FreemarkerManager, override the createConfiguration> method and explicitly call config.setDefaultEncoding("utf-8") here, and> specify this class as the struts.freemarker.manager.classname in> struts.properties, it makes no difference - the output is garbled.> > Does anybody know why this might be the case?> > Thanks> > Jonny> > -- > View this message in context: http://www.nabble.com/Character-encoding-problems-with-Struts-2-and-Freemarker-or-Velocity-tp14538951p14538951.html> Sent from the Struts - User mailing list archive at Nabble.com.> > > ---------------------------------------------------------------------> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org> For additional commands, e-mail: user-help@struts.apache.org>
_________________________________________________________________
The best games are on Xbox 360. Click here for a special offer on an Xbox 360 Console.
http://www.xbox.com/en-US/hardware/wheretobuy/