How to transform the escape characters to original when it shows in reports?

0

Hi guys, I created a report based on my database. Becuase the data in the database has some strange characters, such as "&amp", I wonder if there a way or expression to transform it when previewing the report. Like to add something on Fields expression, so once my report takes the data, the data could be encoded?

Thanks for the help!

victorlizonglin's picture
Joined: May 23 2018 - 12:47pm
Last seen: 1 year 10 months ago

3 Answers:

0

OK, I found the answer.

The question is transform the escape characters suck as "&" to "&". So the actual question should be how to decode the URL escape characters.

The solution is to add a markup element on textField.

<textElement markup="html">

The detailed info could be found in there: http://jasperreports.sourceforge.net/sample.reference/markup/ 

victorlizonglin's picture
Joined: May 23 2018 - 12:47pm
Last seen: 1 year 10 months ago
0

JasperReports will just output what it's given. Do you want to unescape the text? Have you tried using "replace()" method available in the expression editor?

hozawa's picture
63610
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 year 4 weeks ago
0

Thank you hozawa, 

yes I want to unescape the text, I will try to use replace(), thanks

victorlizonglin's picture
Joined: May 23 2018 - 12:47pm
Last seen: 1 year 10 months ago
Feedback