aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string/output_safety.rb
diff options
context:
space:
mode:
authorPhilipp Kempgen (Amooma) <philipp.kempgen@amooma.de>2011-04-14 07:55:10 -0700
committerPhilipp Kempgen (Amooma) <philipp.kempgen@amooma.de>2011-04-14 07:55:10 -0700
commit328a16b31ef6d8970a1d8fe4243c2973e4fd8b94 (patch)
tree6eb7d3ceda43405adbc6a5dedb07bdfa3f6bc29f /activesupport/lib/active_support/core_ext/string/output_safety.rb
parent9257106b09714feb0904bc540e8995953d979622 (diff)
downloadrails-328a16b31ef6d8970a1d8fe4243c2973e4fd8b94.tar.gz
rails-328a16b31ef6d8970a1d8fe4243c2973e4fd8b94.tar.bz2
rails-328a16b31ef6d8970a1d8fe4243c2973e4fd8b94.zip
for escaping HTML can be treated as normal XML
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string/output_safety.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb4
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 = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', "'" => '&apos;' }
+ XML_ESCAPE = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', "'" => '&apos;' }
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