Preventing HTML character entities in locale files from getting munged by Rails3 xss protection

后端 未结 5 1287
遇见更好的自我
遇见更好的自我 2021-02-03 23:58

We\'re building an app, our first using Rails 3, and we\'re having to build I18n in from the outset. Being perfectionists, we want real typography to be used in our views: dashe

5条回答
  •  终归单人心
    2021-02-04 00:29

    Are you aware of the html_safe method that can be used in helpers? I am not sure if I totally understand the problem here since I have never worked with I18n, but would it be possible to use a custom helper that determines if the characters should not be escaped and return "string".html_safe, and if it should be escaped, return "string".

    Or possibly override the "t" helper and add your escaping logic conditions + .html_safe

提交回复
热议问题