Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2011-11-19 07:16:04 +0400
committerJamesNK <james@newtonking.com>2011-11-19 07:16:04 +0400
commit9ef17d05a3613aca5889a6f6b2bde7ab2556d494 (patch)
treea5db8ec95781cbf24c045d16aa5b5c896157f10d /Src/Newtonsoft.Json.Tests/Bson
parent5831b11de11c13761dc82706da5e349ba2739b2e (diff)
-Fixed bad BSON when writing long strings of complex UTF8 characters
-Fixed error not being raised for additional content in JSON string for JArray.Parse and JObject.Parse
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/Bson')
-rw-r--r--Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
index a4935ae..00ed770 100644
--- a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
@@ -1243,5 +1243,24 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.AreEqual(new byte[] { 72, 63, 62, 71, 92, 55 }, newObject.Data);
}
}
+
+#if !(WINDOWS_PHONE || SILVERLIGHT || NET20 || NET35)
+ public void Utf8Text()
+ {
+ string badText =System.IO.File.ReadAllText(@"PoisonText.txt");
+ var j = new JObject();
+ j["test"] = badText;
+
+ var memoryStream = new MemoryStream();
+ var bsonWriter = new BsonWriter(memoryStream);
+ j.WriteTo(bsonWriter);
+ bsonWriter.Flush();
+
+ memoryStream.Position = 0;
+ JObject o = JObject.Load(new BsonReader(memoryStream));
+
+ Assert.AreEqual(badText, (string)o["test"]);
+ }
+#endif
}
} \ No newline at end of file