diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-21 18:42:17 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-21 18:42:17 -0700 |
commit | aae5ebf3eb7d17e668bb05f9c859e239f31b9f50 (patch) | |
tree | b30b5ce03d8f3c5b94fc323b4d65a87f1b889512 /actionpack/lib | |
parent | 35c8a896fc75c222834e1324fe4710c1ba2645c4 (diff) | |
parent | f6ceb944eaea525362db38aa990cac3e6f76ac5a (diff) | |
download | rails-aae5ebf3eb7d17e668bb05f9c859e239f31b9f50.tar.gz rails-aae5ebf3eb7d17e668bb05f9c859e239f31b9f50.tar.bz2 rails-aae5ebf3eb7d17e668bb05f9c859e239f31b9f50.zip |
Merge pull request #2618 from FLOChip/unicode_j
fix escape_javascript for unicode character \u2028.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 4484390fde..f1b071caf7 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -10,7 +10,8 @@ module ActionView "\n" => '\n', "\r" => '\n', '"' => '\\"', - "'" => "\\'" } + "'" => "\\'", + "\342\200\250" => '
' } # Escape carrier returns and single and double quotes for JavaScript segments. # Also available through the alias j(). This is particularly helpful in JavaScript responses, like: @@ -18,7 +19,7 @@ module ActionView # $('some_element').replaceWith('<%=j render 'some/element_template' %>'); def escape_javascript(javascript) if javascript - result = javascript.gsub(/(\\|<\/|\r\n|[\n\r"'])/) {|match| JS_ESCAPE_MAP[match] } + result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|[\n\r"'])/) {|match| JS_ESCAPE_MAP[match] } javascript.html_safe? ? result.html_safe : result else '' |