struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurizio Cucchiara <mcucchi...@apache.org>
Subject Re: Issue with Chinese Charctors - FIXED :)
Date Fri, 29 Jun 2012 14:13:24 GMT
AFAIK You'd need to define per single tag, also, be aware that escape works
as input sanitizer, and by disabling the escape you could encounter
security issue.

Twitter     :http://www.twitter.com/m_cucchiara
G+          :https://plus.google.com/107903711540963855921
Linkedin    :http://www.linkedin.com/in/mauriziocucchiara

Maurizio Cucchiara


On 29 June 2012 14:59, Sathish Kumar <sathishkumar.thiyagarajan@gmail.com>wrote:

> Sorry .. it was application issue  this fix works .....
>
> thanks all for your valuable suggesion ...
>
> Hi Maurizio ...
>
> just one optimization .. is it possible to set escaping attribute value
> globally ...... or do i ned to override all struts 2 tags in my theme ( my
> case it is xhtml )
>
>
>
> On Fri, Jun 29, 2012 at 6:21 PM, Sathish Kumar <
> sathishkumar.thiyagarajan@gmail.com> wrote:
>
> > Wav i did this and it shows proper Chinese text in struts 2 text box
> >
> > [@s.textfield name="entity.label" key="label" escape="true"/]
> >
> > But then :( .... now i get junk characters in plain HTML places where i
> > use these labels
> >
> > is it possible to set this escaping flag from action so that we set
> > escaping flag only when actions class results html form ..
> >
> > On Fri, Jun 29, 2012 at 6:12 PM, Maurizio Cucchiara <
> mcucchiara@apache.org
> > > wrote:
> >
> >> This is the escape attribute (true by default), and what you see should
> be
> >> the html encoding for the corresponding encoded value.
> >> Try to set escape to false
> >>
> >> Sent from my mobile device, so please excuse typos and brevity.
> >>
> >> Maurizio Cucchiara
> >> Il giorno 29/giu/2012 12.56, "Sathish Kumar" <
> >> sathishkumar.thiyagarajan@gmail.com> ha scritto:
> >>
> >> > Hi Dave & Maurizio,
> >> >
> >> > Thanks a lot for such a quick response !!!
> >> >
> >> > I applied below properties in struts and freemarker configurations
> >> >
> >> > struts.properties
> >> > ----------------------
> >> > struts.i18n.encoding=UTF-8
> >> >
> >> > freemarker.properties
> >> > ----------------------------
> >> > default_encoding=UTF-8
> >> > template_update_delay=5
> >> > locale=no_NO
> >> >
> >> > This almost solved the problem .. now data is getting saved and
> rendered
> >> > properly ( in plain HTML tags ) ..... but when we edit this data in
> the
> >> > form using
> >> >
> >> > [@s.textfield name="localesensitivetext" key="localesensitivetext"/]
> >> >
> >> > texy field contains something like &#2980;&#2990;&#3007;&#2996;&#3021;
> >> > instead of actual text ....
> >> >
> >> > Thanks & Regards,
> >> > Sathish Kumar T.
> >> >
> >> > On Fri, Jun 29, 2012 at 4:11 PM, Dave Newton <davelnewton@gmail.com>
> >> > wrote:
> >> >
> >> > > On Fri, Jun 29, 2012 at 6:35 AM, Sathish Kumar wrote:
> >> > >
> >> > > > In our struts 2 project, we support Chinese language. While we
> save
> >> > > Chinese
> >> > > > text in forms we see junk characters getting saved.
> >> > > >
> >> > > > While investigating, we found this link
> >> > > >
> >> > > >
> http://www.mkyong.com/struts2/struts-2-chinese-localization-issue/
> >> > > >
> >> > > > As per this,
> >> > > >
> >> > > > At the top of the JSP Page, we need to include
> >> > > >
> >> > > > *<%@ page contentType=”text/html;charset=UTF-8″ %>*
> >> > > >
> >> > > > Now the issue is, it is only possible with JSP pages. But in
our
> >> case,
> >> > we
> >> > > > use free marker as our result type.
> >> > > >
> >> > > > What is the coresponding freemarker sysntax for the above JSP
> code?
> >> > > >
> >> > >
> >> > > Did you try setting the encoding in the `freemarker.properties` file
> >> as
> >> > per
> >> > > the freemarker support docs [1]?
> >> > >
> >> > > This isn't necessarily what your issue is, though, if you're talking
> >> > > specifically about *saving* I18N data from forms, although it could
> be
> >> > > related.
> >> > >
> >> > > Dave
> >> > >
> >> > > [1] http://struts.apache.org/2.x/docs/freemarker-support.html
> >> > >
> >> >
> >>
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message