问题
I was having a problem with meta attributes being double escaped in Grails, so for instance:<meta name="title" content="${'bla bla "bla"'.encodeAsHTML()}" />
was becoming:<meta name="title" content="bla bla &quot;bla&quot;">
Obviously removing encodeAsHTML() stops the double escape but it is strange as nothing else auto escaped, and not I'm sure where else things might be automatically escaped.
回答1:
It turns out meta
, title
and body
tag's attributes have .encodeAsHTML()
called on them within SiteMeshTagLib.groovy
.
This should really be documented somewhere, because I couldn't find any mention of it and thought it might be a bug.
来源:https://stackoverflow.com/questions/15209240/attributes-in-meta-tags-in-grails-being-auto-escaped