aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-07 03:41:26 -0700
committerJosé Valim <jose.valim@gmail.com>2011-05-07 03:41:26 -0700
commitaaf01cd53718c8aa5b69ac056b997e6dd9893777 (patch)
tree8541f3d2d89d0646d02311ce16cc063143107d7f /activesupport/lib/active_support/core_ext
parent9cc18c52faeebaad6a76bd62cdca1c6b9f96afed (diff)
parent474e313d02f0c8f9d821efe720bd5242e700233f (diff)
downloadrails-aaf01cd53718c8aa5b69ac056b997e6dd9893777.tar.gz
rails-aaf01cd53718c8aa5b69ac056b997e6dd9893777.tar.bz2
rails-aaf01cd53718c8aa5b69ac056b997e6dd9893777.zip
Merge pull request #275 from pk-amooma/master
properly escape "'" to "'" for XML
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-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..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;' }
+ 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