Changeset 9138
- Timestamp:
- 03/29/08 21:48:08 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/lib/active_support/json/encoders/string.rb
r8255 r9138 20 20 class String 21 21 def to_json(options = nil) #:nodoc: 22 '"' + gsub(/[\010\f\n\r\t"\\><&]/) { |s|22 json = '"' + gsub(/[\010\f\n\r\t"\\><&]/) { |s| 23 23 ActiveSupport::JSON::Encoding::ESCAPED_CHARS[s] 24 }.gsub(/([\xC0-\xDF][\x80-\xBF]| 24 } 25 json.force_encoding('ascii-8bit') if respond_to?(:force_encoding) 26 json.gsub(/([\xC0-\xDF][\x80-\xBF]| 25 27 [\xE0-\xEF][\x80-\xBF]{2}| 26 28 [\xF0-\xF7][\x80-\xBF]{3})+/nx) { |s|