You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yaragalla Muralidhar <ya...@gmail.com> on 2015/07/30 10:31:21 UTC
printing mathematical special characters
I have mathematical symbols e.g. *alfa*, *beta*,*mu* . When I copy these
symbols in text area they are getting copied. I am copying them from word
document. When I insert them into the database using prepared statement the
symbols are getting inserted as code. for example the *alfa* is getting
stored asβ. This is fine I guess. But when I retrieve them from the
database using java.sq.Statement and displaying them in the html page they
are getting displayed as code instead of symbol. I mean "β" is
displayed in html instead displaying alfa symbol. So how to deal with this
situation? how can I store symbols and display them properly in html?
I am using mysql database, java1.7,struts2.0 and tomcat7.
*Thanks and Regards,*
Muralidhar Yaragalla.
*http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
Re: printing mathematical special characters
Posted by Christoph Nenning <Ch...@lex-com.net>.
The fastest approach would be to disable struts encoding when displaying
them (you can see docs of <s:property />). But I would rather suggest to
figure out where that encoding comes from. You might use browser dev tools
to see how the browser submits it. Then you can use a debugger or logging
to show them in the struts action and in your data layer. When you know
where that encoding takes place you can search for ways to disable it.
In our apps we enable UTF-8 encoding in application server settings an in
the database to avoid such issues.
regards,
Christoph
> From: Yaragalla Muralidhar <ya...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>,
> Date: 30.07.2015 10:31
> Subject: printing mathematical special characters
>
> I have mathematical symbols e.g. *alfa*, *beta*,*mu* . When I copy these
> symbols in text area they are getting copied. I am copying them from
word
> document. When I insert them into the database using prepared statement
the
> symbols are getting inserted as code. for example the *alfa* is getting
> stored asβ. This is fine I guess. But when I retrieve them from the
> database using java.sq.Statement and displaying them in the html page
they
> are getting displayed as code instead of symbol. I mean "β" is
> displayed in html instead displaying alfa symbol. So how to deal with
this
> situation? how can I store symbols and display them properly in html?
>
> I am using mysql database, java1.7,struts2.0 and tomcat7.
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
This Email was scanned by Sophos Anti Virus
Re: printing mathematical special characters
Posted by Christoph Nenning <Ch...@lex-com.net>.
> you should now that disabling the default escaping can lead to serious
> security issues
Because of this I wrote:
> But I would rather suggest to figure out where that encoding comes from.
And I mean to analyze the saving not the display. You should take care
that those values are stored as utf8 strings inside database, not encoded.
Regards,
Christoph
> From: Bruno Wintenberger <br...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>,
> Date: 30.07.2015 10:52
> Subject: Re: printing mathematical special characters
>
> Hello Yaragalla,
> you should now that disabling the default escaping can lead to serious
> security issues (mainly XSS :
> https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29).
>
> 2015-07-30 10:49 GMT+02:00 Yaragalla Muralidhar
<ya...@gmail.com>:
>
> > Ok Christoph. Thanks for your response. I found that struts is doing
it.
> > <s:property value="name" escape="false" /> helped me to an extent.
> >
> > *Thanks and Regards,*
> > Muralidhar Yaragalla.
> >
> > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> >
> > On Thu, Jul 30, 2015 at 2:01 PM, Yaragalla Muralidhar <
> > yaragallamurali@gmail.com> wrote:
> >
> > >
> > >
> > > I have mathematical symbols e.g. *alfa*, *beta*,*mu* . When I copy
these
> > > symbols in text area they are getting copied. I am copying them from
word
> > > document. When I insert them into the database using prepared
statement
> > the
> > > symbols are getting inserted as code. for example the *alfa* is
getting
> > > stored asβ. This is fine I guess. But when I retrieve them from
the
> > > database using java.sq.Statement and displaying them in the html
page
> > they
> > > are getting displayed as code instead of symbol. I mean "β" is
> > > displayed in html instead displaying alfa symbol. So how to deal
with
> > this
> > > situation? how can I store symbols and display them properly in
html?
> > >
> > > I am using mysql database, java1.7,struts2.0 and tomcat7.
> > > *Thanks and Regards,*
> > > Muralidhar Yaragalla.
> > >
> > > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> > >
> >
This Email was scanned by Sophos Anti Virus
Re: printing mathematical special characters
Posted by Bruno Wintenberger <br...@gmail.com>.
Hello Yaragalla,
you should now that disabling the default escaping can lead to serious
security issues (mainly XSS :
https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29).
2015-07-30 10:49 GMT+02:00 Yaragalla Muralidhar <ya...@gmail.com>:
> Ok Christoph. Thanks for your response. I found that struts is doing it.
> <s:property value="name" escape="false" /> helped me to an extent.
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>
> On Thu, Jul 30, 2015 at 2:01 PM, Yaragalla Muralidhar <
> yaragallamurali@gmail.com> wrote:
>
> >
> >
> > I have mathematical symbols e.g. *alfa*, *beta*,*mu* . When I copy these
> > symbols in text area they are getting copied. I am copying them from word
> > document. When I insert them into the database using prepared statement
> the
> > symbols are getting inserted as code. for example the *alfa* is getting
> > stored asβ. This is fine I guess. But when I retrieve them from the
> > database using java.sq.Statement and displaying them in the html page
> they
> > are getting displayed as code instead of symbol. I mean "β" is
> > displayed in html instead displaying alfa symbol. So how to deal with
> this
> > situation? how can I store symbols and display them properly in html?
> >
> > I am using mysql database, java1.7,struts2.0 and tomcat7.
> > *Thanks and Regards,*
> > Muralidhar Yaragalla.
> >
> > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
> >
>
Re: printing mathematical special characters
Posted by Yaragalla Muralidhar <ya...@gmail.com>.
Ok Christoph. Thanks for your response. I found that struts is doing it.
<s:property value="name" escape="false" /> helped me to an extent.
*Thanks and Regards,*
Muralidhar Yaragalla.
*http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
On Thu, Jul 30, 2015 at 2:01 PM, Yaragalla Muralidhar <
yaragallamurali@gmail.com> wrote:
>
>
> I have mathematical symbols e.g. *alfa*, *beta*,*mu* . When I copy these
> symbols in text area they are getting copied. I am copying them from word
> document. When I insert them into the database using prepared statement the
> symbols are getting inserted as code. for example the *alfa* is getting
> stored asβ. This is fine I guess. But when I retrieve them from the
> database using java.sq.Statement and displaying them in the html page they
> are getting displayed as code instead of symbol. I mean "β" is
> displayed in html instead displaying alfa symbol. So how to deal with this
> situation? how can I store symbols and display them properly in html?
>
> I am using mysql database, java1.7,struts2.0 and tomcat7.
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>