Added fix for Bug 20869
authorOleg Stepanischev <Oleg.Stepanischev@tatar.ru>
Thu, 26 Jun 2014 18:24:34 +0000 (22:24 +0400)
committerOleg Stepanischev <Oleg.Stepanischev@tatar.ru>
Thu, 26 Jun 2014 18:24:34 +0000 (22:24 +0400)
mcs/class/System.Json/System.Json/JsonValue.cs
mcs/class/System.Json/Test/System.Json/JsonValueTest.cs

index 1d16b88e3f40407f1994efc04735c38bc269fada..39722f5c16937b059caa4d3f998af28a4633ee61 100644 (file)
@@ -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 ();
index 2459c1fc3ad0f27478d902ffaccc6f2ec3f0d371..c3347c689d9999f8bba2514beb75f6c2fedb7098 100644 (file)
@@ -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 (), "\"\\\"\\\"\"");
+               }
        }
 }