diff options
author | Philipp Kempgen (Amooma) <philipp.kempgen@amooma.de> | 2011-04-14 07:55:10 -0700 |
---|---|---|
committer | Philipp Kempgen (Amooma) <philipp.kempgen@amooma.de> | 2011-04-14 07:55:10 -0700 |
commit | 328a16b31ef6d8970a1d8fe4243c2973e4fd8b94 (patch) | |
tree | 6eb7d3ceda43405adbc6a5dedb07bdfa3f6bc29f /activesupport | |
parent | 9257106b09714feb0904bc540e8995953d979622 (diff) | |
download | rails-328a16b31ef6d8970a1d8fe4243c2973e4fd8b94.tar.gz rails-328a16b31ef6d8970a1d8fe4243c2973e4fd8b94.tar.bz2 rails-328a16b31ef6d8970a1d8fe4243c2973e4fd8b94.zip |
for escaping HTML can be treated as normal XML
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 252168dacc..6f410819ba 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -3,7 +3,7 @@ require 'active_support/core_ext/kernel/singleton_class' class ERB module Util - HTML_ESCAPE = { '&' => '&', '>' => '>', '<' => '<', '"' => '"', "'" => ''' } + XML_ESCAPE = { '&' => '&', '>' => '>', '<' => '<', '"' => '"', "'" => ''' } JSON_ESCAPE = { '&' => '\u0026', '>' => '\u003E', '<' => '\u003C' } # A utility method for escaping HTML tag characters. @@ -20,7 +20,7 @@ class ERB if s.html_safe? s else - s.gsub(/[&"'><]/) { |special| HTML_ESCAPE[special] }.html_safe + s.gsub(/[&"'><]/) { |special| XML_ESCAPE[special] }.html_safe end end |