问题描述
我遇到了元属性在Grails中双重转义的问题,例如:
< meta name =titlecontent =$ {'bla bla bla'。encodeAsHTML()}/>
正在变为:
< meta name =title content =bla bla& amp; amp; amp; amp; amp; quot;>
显然,去除encodeAsHTML否则自动转义,而不是我确定自动转义的地方。
事实证明 meta ,标题和 body 标记的属性具有。 encodeAsHTML()在 SiteMeshTagLib.groovy 中调用它们。
这应该是真的记录在某处,因为我找不到任何提及它,并认为它可能是一个错误。
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.
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.
这篇关于Grails中元标记的属性被自动转义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!