Changeset 6893
- Timestamp:
- 05/29/07 09:10:36 (1 year ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/json/encoders/string.rb (modified) (2 diffs)
- trunk/activesupport/test/json/encoding_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r6886 r6893 1 1 *SVN* 2 3 * escape <'s and >'s in JSON strings. #8371 [Rick] 2 4 3 5 * Inflections: MatrixTest -> MatrixTests instead of MatricesTest. #8496 [jbwiv] trunk/activesupport/lib/active_support/json/encoders/string.rb
r6443 r6893 9 9 "\t" => '\t', 10 10 '"' => '\"', 11 '\\' => '\\\\' 11 '\\' => '\\\\', 12 ">" => '\076', 13 '<' => '\074' 12 14 } 13 15 end … … 17 19 class String 18 20 def to_json #:nodoc: 19 '"' + gsub(/[\010\f\n\r\t"\\ ]/) { |s|21 '"' + gsub(/[\010\f\n\r\t"\\><]/) { |s| 20 22 ActiveSupport::JSON::Encoding::ESCAPED_CHARS[s] 21 23 }.gsub(/([\xC0-\xDF][\x80-\xBF]| trunk/activesupport/test/json/encoding_test.rb
r6822 r6893 14 14 [ 2.5, %(2.5) ]] 15 15 16 StringTests = [[ 'this is the string', %("this is the string")],16 StringTests = [[ 'this is the <string>', %("this is the \\074string\\076")], 17 17 [ 'a "string" with quotes', %("a \\"string\\" with quotes") ]] 18 18