views:

426

answers:

1

I am trying to create a pdf document with JasperReports. Everything works fine, except than when an & character appears, some tags are not interpreted, and appear in the final document.

Do i have to escape de "&" character? I've already tried writing & instead, as well as wrapping a around it. In the first case, & appeared in my pdf, and in the second one, the ampersand dissapeared from it.

My JasperReport element is:

<textFieldExpression   class="java.lang.String"><![CDATA[$P{footer}]]></textFieldExpression>

Eg. desired: a & b

First attempt: a "& amp;" b. Result: a "& amp;" b

Second attempt: a "< ! [ CDATA[& ]] > b". Result: a b

(I've added some spaces and quotes to avoid string formatting in this editor)

Any clues?

EDIT: Please read first comment.

A: 

Have you tried escaping to ASCII or Unicode:

  • "a &#38; b"
  • "a &#x0026; b"

?

banjollity