aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-10 14:13:28 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-10 14:13:28 -0300
commit5602c73eca9a5c764621fcbf4ce0b7613d543699 (patch)
tree520177f90f08e7e7e3501a96959e90dd26a001fe /activesupport
parent1f11dbf0b4dacede0da1be1a0675e501d1b0fced (diff)
parent9b8ee8e006db581eb34dc0fa1d230653b7a1c956 (diff)
downloadrails-5602c73eca9a5c764621fcbf4ce0b7613d543699.tar.gz
rails-5602c73eca9a5c764621fcbf4ce0b7613d543699.tar.bz2
rails-5602c73eca9a5c764621fcbf4ce0b7613d543699.zip
Merge pull request #10057 from zackham/patch-1
Escape multibyte line terminators in JSON encoding
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/json/encoding.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index 9bf1ea35b3..71dfbf3323 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -98,6 +98,8 @@ module ActiveSupport
"\010" => '\b',
"\f" => '\f',
"\n" => '\n',
+ "\xe2\x80\xa8" => '\u2028',
+ "\xe2\x80\xa9" => '\u2029',
"\r" => '\r',
"\t" => '\t',
'"' => '\"',
@@ -121,9 +123,9 @@ module ActiveSupport
def escape_html_entities_in_json=(value)
self.escape_regex = \
if @escape_html_entities_in_json = value
- /[\x00-\x1F"\\><&]/
+ /\xe2\x80(\xa8|\xa9)|[\x00-\x1F"\\><&]/
else
- /[\x00-\x1F"\\]/
+ /\xe2\x80(\xa8|\xa9)|[\x00-\x1F"\\]/
end
end