4

I'm using the CKEditor plugin of Grails and while I can store the HTML content from CKEditor to the database, I can not render it properly in the view.

What I'm getting in the view is the HTML escaped and not as mark-up content.

<p> sdfsdfsadf</p> <p> asdfasdfasdf</p> <p> asdfasdfasdf</p> <p> &yen;</p>

When I want:

sdfsdfsadf
asdfasdfasdf
asdfasdfasdf
¥

How do I get the stored data to render properly?

John Giotta
  • 16,432
  • 7
  • 52
  • 82
  • 1
    http://stackoverflow.com/questions/1337464/overriding-grails-views-default-codec-html-config-back-to-none – cdeszaq Jul 26 '12 at 17:15

3 Answers3

6

Migrated to Grails 2.4 and after some head scratching, found <%=expression%> is deprecated.

Using the new syntax ${raw(expression)} solved my issue.

Warren Kim
  • 306
  • 3
  • 4
2

try ${instance?.attribute?.decodeHTML()}

Roberto Perez Alcolea
  • 1,408
  • 11
  • 11
1

From John Flinchbaugh's Answer on this question about codecs and encodings:

To disable HTML encoding for one expression in a page that is otherwise defaulting to HTML, use <%=expression%> notation instead of ${...}.

Community
  • 1
  • 1
cdeszaq
  • 30,869
  • 25
  • 117
  • 173