diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-10 14:13:28 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-10 14:13:28 -0300 |
commit | 5602c73eca9a5c764621fcbf4ce0b7613d543699 (patch) | |
tree | 520177f90f08e7e7e3501a96959e90dd26a001fe | |
parent | 1f11dbf0b4dacede0da1be1a0675e501d1b0fced (diff) | |
parent | 9b8ee8e006db581eb34dc0fa1d230653b7a1c956 (diff) | |
download | rails-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
-rw-r--r-- | activesupport/lib/active_support/json/encoding.rb | 6 |
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 |