diff options
author | Oleg Stepanischev <Oleg.Stepanischev@tatar.ru> | 2014-06-26 22:24:34 +0400 |
---|---|---|
committer | Oleg Stepanischev <Oleg.Stepanischev@tatar.ru> | 2014-06-26 22:24:34 +0400 |
commit | f7b81bda13d482bdb07ece400021537311154746 (patch) | |
tree | bfa54ae87a129abc1111687a863026b6dd949ea6 | |
parent | 429cdf17cf3a4887d9882380beebbf0d119e65ab (diff) |
Added fix for Bug 20869
-rw-r--r-- | mcs/class/System.Json/System.Json/JsonValue.cs | 4 | ||||
-rw-r--r-- | mcs/class/System.Json/Test/System.Json/JsonValueTest.cs | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/mcs/class/System.Json/System.Json/JsonValue.cs b/mcs/class/System.Json/System.Json/JsonValue.cs index 1d16b88e3f4..39722f5c169 100644 --- a/mcs/class/System.Json/System.Json/JsonValue.cs +++ b/mcs/class/System.Json/System.Json/JsonValue.cs @@ -218,8 +218,8 @@ namespace System.Json if (src [i] == '"' || src [i] == '\\') { sb.Append (src, start, i - start); sb.Append ('\\'); - sb.Append (src [i++]); - start = i; + sb.Append (src [i]); + start = i + 1; } sb.Append (src, start, src.Length - start); return sb.ToString (); diff --git a/mcs/class/System.Json/Test/System.Json/JsonValueTest.cs b/mcs/class/System.Json/Test/System.Json/JsonValueTest.cs index 2459c1fc3ad..c3347c689d9 100644 --- a/mcs/class/System.Json/Test/System.Json/JsonValueTest.cs +++ b/mcs/class/System.Json/Test/System.Json/JsonValueTest.cs @@ -35,5 +35,11 @@ namespace MonoTests.System var str = j.ToString (); Assert.AreEqual (str, "[1, 2, 3, null]"); } + + [Test] + public void QuoteEscapeBug_20869 () + { + Assert.AreEqual ((new JsonPrimitive ("\"\"")).ToString (), "\"\\\"\\\"\""); + } } } |