Skip to content

Grails 2.3.5 Encoding Causes Invalid Script Generation #28

@greggilles

Description

@greggilles

SUMMARY:
Grails 2.3.5 includes new default encoding settings in Config.groovy. The new encoidng appears to be causing the generated javascript to include & #39; instead of '.

STEPS
Specifically, when using Grails 2.3.5 with Java 1.7.0_25, the Javascript that is created uses & #39 ; instead of the actual apostrophe for .addRow data and options (such as title), and as a result, none of the visualizations render for me in either IE or Chrome.

To verify, I tried modifying the generated Javascript by replacing the & #39; with apostrophe's and it works. I tried creating identical clean projects, one with Grails 2.2.3 and one with Grails 2.3.5, and the older Grails version works and the new version doesn't. The Javascript generated using Grails 2.2.3 includes regular apostrophes for the addRow data.

For my test, I used "compile ":google-visualization:0.6.2" and a copy and past of the code from here https://github.com/bmuschko/grails-google-visualization/blob/master/grails-app/views/index.gsp.

SOLUTION
To fix, I modified the _visualization_javascripts.gsp file as follows:

changed from <%=row %> TO <%=raw(row) %>
changed from <%=visualizationData.options%> TO <%=raw(visualizationData.options)%>

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions