aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common
diff options
context:
space:
mode:
authorlbsa712007-07-05 18:31:59 +0000
committerlbsa712007-07-05 18:31:59 +0000
commit8df2119bc766132a36edb988d0963196694c4aa3 (patch)
treede10688a3b2255667a9190a6bf5a0483ab34a4d2 /Common
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 '')
-rw-r--r--Common/XmlRpcCS/SimpleHttpRequest.cs7
-rw-r--r--Common/XmlRpcCS/XmlRpcRequest.cs2
-rw-r--r--Common/XmlRpcCS/XmlRpcResponder.cs4
-rw-r--r--Common/XmlRpcCS/XmlRpcSerializer.cs26
4 files changed, 26 insertions, 13 deletions
diff --git a/Common/XmlRpcCS/SimpleHttpRequest.cs b/Common/XmlRpcCS/SimpleHttpRequest.cs
index 58a5ae4..aa260f4 100644
--- a/Common/XmlRpcCS/SimpleHttpRequest.cs
+++ b/Common/XmlRpcCS/SimpleHttpRequest.cs
@@ -31,6 +31,7 @@ namespace Nwc.XmlRpc
31 using System.IO; 31 using System.IO;
32 using System.Net.Sockets; 32 using System.Net.Sockets;
33 using System.Collections; 33 using System.Collections;
34 using System.Text;
34 35
35 ///<summary>Very basic HTTP request handler.</summary> 36 ///<summary>Very basic HTTP request handler.</summary>
36 ///<remarks>This class is designed to accept a TcpClient and treat it as an HTTP request. 37 ///<remarks>This class is designed to accept a TcpClient and treat it as an HTTP request.
@@ -55,8 +56,10 @@ namespace Nwc.XmlRpc
55 public SimpleHttpRequest(TcpClient client) 56 public SimpleHttpRequest(TcpClient client)
56 { 57 {
57 _client = client; 58 _client = client;
58 _output = new StreamWriter(client.GetStream()); 59
59 _input = new StreamReader(client.GetStream()); 60 _output = new StreamWriter(client.GetStream(), Encoding.UTF8 );
61 _input = new StreamReader(client.GetStream(), Encoding.UTF8 );
62
60 GetRequestMethod(); 63 GetRequestMethod();
61 GetRequestHeaders(); 64 GetRequestHeaders();
62 } 65 }
diff --git a/Common/XmlRpcCS/XmlRpcRequest.cs b/Common/XmlRpcCS/XmlRpcRequest.cs
index 2bac115..71a0dc9 100644
--- a/Common/XmlRpcCS/XmlRpcRequest.cs
+++ b/Common/XmlRpcCS/XmlRpcRequest.cs
@@ -56,7 +56,7 @@ namespace Nwc.XmlRpc
56 public class XmlRpcRequest 56 public class XmlRpcRequest
57 { 57 {
58 private String _methodName = null; 58 private String _methodName = null;
59 private Encoding _encoding = new ASCIIEncoding(); 59 private Encoding _encoding = new UTF8Encoding();
60 private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); 60 private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
61 private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); 61 private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
62 62
diff --git a/Common/XmlRpcCS/XmlRpcResponder.cs b/Common/XmlRpcCS/XmlRpcResponder.cs
index 41f855c..05377a2 100644
--- a/Common/XmlRpcCS/XmlRpcResponder.cs
+++ b/Common/XmlRpcCS/XmlRpcResponder.cs
@@ -30,6 +30,7 @@ namespace Nwc.XmlRpc
30 using System; 30 using System;
31 using System.Xml; 31 using System.Xml;
32 using System.Net.Sockets; 32 using System.Net.Sockets;
33 using System.Text;
33 34
34 /// <summary>The class is a container of the context of an XML-RPC dialog on the server side.</summary> 35 /// <summary>The class is a container of the context of an XML-RPC dialog on the server side.</summary>
35 /// <remarks>Instances of this class maintain the context for an individual XML-RPC server 36 /// <remarks>Instances of this class maintain the context for an individual XML-RPC server
@@ -98,8 +99,9 @@ namespace Nwc.XmlRpc
98 if (Logger.Delegate != null) 99 if (Logger.Delegate != null)
99 Logger.WriteEntry(xmlRpcResp.ToString(), LogLevel.Information); 100 Logger.WriteEntry(xmlRpcResp.ToString(), LogLevel.Information);
100 101
101 XmlRpcServer.HttpHeader(httpReq.Protocol, "text/xml", 0, " 200 OK", httpReq.Output); 102 XmlRpcServer.HttpHeader(httpReq.Protocol, "text/xml", 0, " 200 OK", httpReq.Output);
102 httpReq.Output.Flush(); 103 httpReq.Output.Flush();
104
103 XmlTextWriter xml = new XmlTextWriter(httpReq.Output); 105 XmlTextWriter xml = new XmlTextWriter(httpReq.Output);
104 _serializer.Serialize(xml, xmlRpcResp); 106 _serializer.Serialize(xml, xmlRpcResp);
105 xml.Flush(); 107 xml.Flush();
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>