lib/json_builder/extensions.rb in json_builder-3.1.5 vs lib/json_builder/extensions.rb in json_builder-3.1.6
- old
+ new
@@ -17,10 +17,11 @@
'\\' => '\\\\',
'</' => '<\/',
"\r\n" => '\n',
"\n" => '\n',
"\r" => '\n',
+ "\t" => '\t',
'"' => '\\"',
"'" => "\'"
}
def to_builder
@@ -28,10 +29,10 @@
end
private
def json_escape
- gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u) { |match|
+ gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\t\n\r"'])/u) { |match|
JS_ESCAPE_MAP[match]
}
end
end