Index: test/json/encoding_test.rb =================================================================== --- test/json/encoding_test.rb (revision 6825) +++ test/json/encoding_test.rb (working copy) @@ -13,7 +13,7 @@ NumericTests = [[ 1, %(1) ], [ 2.5, %(2.5) ]] - StringTests = [[ 'this is the string', %("this is the string") ], + StringTests = [[ 'this is the ', %("this is the \\074string\\076")], [ 'a "string" with quotes', %("a \\"string\\" with quotes") ]] ArrayTests = [[ ['a', 'b', 'c'], %([\"a\", \"b\", \"c\"]) ], Index: lib/active_support/json/encoders/string.rb =================================================================== --- lib/active_support/json/encoders/string.rb (revision 6825) +++ lib/active_support/json/encoders/string.rb (working copy) @@ -8,7 +8,9 @@ "\r" => '\r', "\t" => '\t', '"' => '\"', - '\\' => '\\\\' + '\\' => '\\\\', + ">" => '\076', + '<' => '\074' } end end @@ -16,7 +18,7 @@ class String def to_json #:nodoc: - '"' + gsub(/[\010\f\n\r\t"\\]/) { |s| + '"' + gsub(/[\010\f\n\r\t"\\><]/) { |s| ActiveSupport::JSON::Encoding::ESCAPED_CHARS[s] }.gsub(/([\xC0-\xDF][\x80-\xBF]| [\xE0-\xEF][\x80-\xBF]{2}|