Attributes in meta tags in Grails being auto escaped

给你一囗甜甜゛ 提交于 2019-12-24 09:24:12

问题


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 &amp;quot;bla&amp;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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!