Changeset 9238 for trunk/activesupport/lib/active_support/json
- Timestamp:
- 04/08/08 03:45:26 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/lib/active_support/json/encoders/string.rb
r9138 r9238 2 2 module JSON 3 3 module Encoding 4 mattr_accessor :escape_regex 5 4 6 ESCAPED_CHARS = { 5 7 "\010" => '\b', … … 18 20 end 19 21 22 ActiveSupport.escape_html_entities_in_json = true 23 20 24 class String 21 25 def to_json(options = nil) #:nodoc: 22 json = '"' + gsub( /[\010\f\n\r\t"\\><&]/) { |s|26 json = '"' + gsub(ActiveSupport::JSON::Encoding.escape_regex) { |s| 23 27 ActiveSupport::JSON::Encoding::ESCAPED_CHARS[s] 24 28 } trunk/activesupport/lib/active_support/json/encoding.rb
r7736 r9238 1 1 require 'active_support/json/variable' 2 3 2 require 'active_support/json/encoders/object' # Require explicitly for rdoc. 4 3 Dir["#{File.dirname(__FILE__)}/encoders/**/*.rb"].each do |file|