From 81aedadad68620835486ad7b340915af786cc3cd Mon Sep 17 00:00:00 2001 From: qupeng Date: Wed, 21 Jun 2017 17:04:03 +0800 Subject: [PATCH] json: be more compatible with MySQL' document instead of implement. --- util/types/json/functions.go | 2 +- util/types/json/functions_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/util/types/json/functions.go b/util/types/json/functions.go index 5cc0089674d77..5a2c13ba8224f 100644 --- a/util/types/json/functions.go +++ b/util/types/json/functions.go @@ -119,7 +119,7 @@ func unquoteString(s string) (string, error) { ret.Write(char[0:size]) i += 5 default: - ret.WriteByte('\\') + // For all other escape sequences, backslash is ignored. ret.WriteByte(s[i]) } } else { diff --git a/util/types/json/functions_test.go b/util/types/json/functions_test.go index 32313a4b6b838..ed807124b5c9d 100644 --- a/util/types/json/functions_test.go +++ b/util/types/json/functions_test.go @@ -105,7 +105,7 @@ func (s *testJSONSuite) TestUnquoteString(c *C) { input string output string }{ - {"bad escaped: \\a", "bad escaped: \\a"}, + {"bad escaped: \\a", "bad escaped: a"}, {"good escaped: \\b \\f \\n \\r \\t \\\\ \u4f60", "good escaped: \b \f \n \r \t \\ 你"}, {"quoted string: hello \\\"quoted\\\" world", "quoted string: hello \"quoted\" world"}, }