[longomatch] Force UTF8 encoding and Unix new lines for serialized objects
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Force UTF8 encoding and Unix new lines for serialized objects
- Date: Sat, 22 Nov 2014 10:53:44 +0000 (UTC)
commit c67f91d80a348703c376bc7abac09f268850993b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Nov 14 20:06:53 2014 +0100
Force UTF8 encoding and Unix new lines for serialized objects
LongoMatch.Core/Common/Serializer.cs | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Serializer.cs b/LongoMatch.Core/Common/Serializer.cs
index 5c5b169..15d8949 100644
--- a/LongoMatch.Core/Common/Serializer.cs
+++ b/LongoMatch.Core/Common/Serializer.cs
@@ -47,7 +47,8 @@ namespace LongoMatch.Core.Common
xmlformatter.Serialize(stream, obj);
break;
case SerializationType.Json:
- StreamWriter sw = new StreamWriter (stream);
+ StreamWriter sw = new StreamWriter (stream, Encoding.UTF8);
+ sw.NewLine = "\n";
sw.Write (JsonConvert.SerializeObject (obj, JsonSettings));
sw.Flush();
break;
@@ -73,7 +74,7 @@ namespace LongoMatch.Core.Common
XmlSerializer xmlformatter = new XmlSerializer(typeof(T));
return (T) xmlformatter.Deserialize(stream);
case SerializationType.Json:
- StreamReader sr = new StreamReader (stream);
+ StreamReader sr = new StreamReader (stream, Encoding.UTF8);
return JsonConvert.DeserializeObject<T> (sr.ReadToEnd(), JsonSettings);
default:
throw new Exception();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]