aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorPhilipp Kempgen (Amooma) <philipp.kempgen@amooma.de>2011-04-14 07:51:14 -0700
committerPhilipp Kempgen (Amooma) <philipp.kempgen@amooma.de>2011-04-14 07:51:14 -0700
commit9257106b09714feb0904bc540e8995953d979622 (patch)
tree1b4d7c3387925d3e8e229688c94b57d3420aefd0 /activesupport
parentfb6fa1e42507d1a2d7b7ba4b878763084e96f805 (diff)
downloadrails-9257106b09714feb0904bc540e8995953d979622.tar.gz
rails-9257106b09714feb0904bc540e8995953d979622.tar.bz2
rails-9257106b09714feb0904bc540e8995953d979622.zip
properly escape "'" to "&apos;" for XML/HTML (BTW Erubis does that as well)
Diffstat (limited to 'activesupport')
-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 c27cbc37c5..252168dacc 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;' }
+ HTML_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| HTML_ESCAPE[special] }.html_safe
end
end