aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/XmlRpcCS/XmlRpcSerializer.cs
diff options
context:
space:
mode:
authorlbsa712007-07-05 18:31:59 +0000
committerlbsa712007-07-05 18:31:59 +0000
commit8df2119bc766132a36edb988d0963196694c4aa3 (patch)
treede10688a3b2255667a9190a6bf5a0483ab34a4d2 /Common/XmlRpcCS/XmlRpcSerializer.cs
parent* Making trunk compile again for CC.net (diff)
downloadopensim-SC-8df2119bc766132a36edb988d0963196694c4aa3.zip
opensim-SC-8df2119bc766132a36edb988d0963196694c4aa3.tar.gz
opensim-SC-8df2119bc766132a36edb988d0963196694c4aa3.tar.bz2
opensim-SC-8df2119bc766132a36edb988d0963196694c4aa3.tar.xz
* Changed XmlRpc to specify utf-8
Diffstat (limited to 'Common/XmlRpcCS/XmlRpcSerializer.cs')
-rw-r--r--Common/XmlRpcCS/XmlRpcSerializer.cs26
1 files changed, 17 insertions, 9 deletions
diff --git a/Common/XmlRpcCS/XmlRpcSerializer.cs b/Common/XmlRpcCS/XmlRpcSerializer.cs
index a75770e..b682f69 100644
--- a/Common/XmlRpcCS/XmlRpcSerializer.cs
+++ b/Common/XmlRpcCS/XmlRpcSerializer.cs
@@ -31,6 +31,7 @@ namespace Nwc.XmlRpc
31 using System.Collections; 31 using System.Collections;
32 using System.IO; 32 using System.IO;
33 using System.Xml; 33 using System.Xml;
34 using System.Text;
34 35
35 /// <summary>Base class of classes serializing data to XML-RPC's XML format.</summary> 36 /// <summary>Base class of classes serializing data to XML-RPC's XML format.</summary>
36 /// <remarks>This class handles the basic type conversions like Integer to &lt;i4&gt;. </remarks> 37 /// <remarks>This class handles the basic type conversions like Integer to &lt;i4&gt;. </remarks>
@@ -53,15 +54,22 @@ namespace Nwc.XmlRpc
53 /// <seealso cref="XmlRpcRequest"/> 54 /// <seealso cref="XmlRpcRequest"/>
54 public String Serialize(Object obj) 55 public String Serialize(Object obj)
55 { 56 {
56 StringWriter strBuf = new StringWriter(); 57 using (MemoryStream memStream = new MemoryStream(4096))
57 XmlTextWriter xml = new XmlTextWriter(strBuf); 58 {
58 xml.Formatting = Formatting.Indented; 59 XmlTextWriter xml = new XmlTextWriter(memStream, Encoding.UTF8);
59 xml.Indentation = 4; 60 xml.Formatting = Formatting.Indented;
60 Serialize(xml, obj); 61 xml.Indentation = 4;
61 xml.Flush(); 62 Serialize(xml, obj);
62 String returns = strBuf.ToString(); 63 xml.Flush();
63 xml.Close(); 64
64 return returns; 65 byte[] resultBytes = memStream.ToArray();
66
67 UTF8Encoding encoder = new UTF8Encoding();
68
69 String returns = encoder.GetString( resultBytes, 0, resultBytes.Length );
70 xml.Close();
71 return returns;
72 }
65 } 73 }
66 74
67 /// <remarks>Serialize the object to the output stream.</remarks> 75 /// <remarks>Serialize the object to the output stream.</remarks>