Fixed XML encoding bug thanks to MW

ogs-cs
gareth 2007-03-12 13:46:08 +00:00
parent 297cef3e18
commit d06367b68d
3 changed files with 8 additions and 12 deletions

View File

@ -98,7 +98,7 @@ namespace OpenGridServices
SimInfoData["sendkey"]=TheSim.sendkey; SimInfoData["sendkey"]=TheSim.sendkey;
SimInfoData["recvkey"]=TheSim.recvkey; SimInfoData["recvkey"]=TheSim.recvkey;
SimInfoResp.Value=SimInfoData; SimInfoResp.Value=SimInfoData;
return(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp)); return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp),"utf-16","utf-8"));
} else { } else {
XmlRpcResponse SimErrorResp = new XmlRpcResponse(); XmlRpcResponse SimErrorResp = new XmlRpcResponse();
Hashtable SimErrorData = new Hashtable(); Hashtable SimErrorData = new Hashtable();
@ -129,7 +129,7 @@ namespace OpenGridServices
response.SendChunked=false; response.SendChunked=false;
System.IO.Stream body = request.InputStream; System.IO.Stream body = request.InputStream;
System.Text.Encoding encoding = request.ContentEncoding; System.Text.Encoding encoding = System.Text.Encoding.UTF8;
System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
string requestBody = reader.ReadToEnd(); string requestBody = reader.ReadToEnd();
@ -152,11 +152,9 @@ namespace OpenGridServices
} }
byte[] buffer = System.Text.Encoding.Unicode.GetBytes(responseString); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
System.IO.Stream output = response.OutputStream; System.IO.Stream output = response.OutputStream;
response.SendChunked=false; response.SendChunked=false;
encoding = System.Text.Encoding.Unicode;
response.ContentEncoding = encoding;
response.ContentLength64=buffer.Length; response.ContentLength64=buffer.Length;
output.Write(buffer,0,buffer.Length); output.Write(buffer,0,buffer.Length);
output.Close(); output.Close();

View File

@ -128,8 +128,8 @@ namespace OpenGridServices
LoginFlags["ever_logged_in"]="Y"; LoginFlags["ever_logged_in"]="Y";
LoginGoodData["message"]=OpenUser_Main.userserver.DefaultStartupMsg; LoginGoodData["message"]=OpenUser_Main.userserver.DefaultStartupMsg;
LoginGoodData["session_id"]=TheUser.CurrentSessionID; LoginGoodData["session_id"]=TheUser.CurrentSessionID.ToString();
LoginGoodData["secure_sessionid"]=TheUser.CurrentSecureSessionID; LoginGoodData["secure_sessionid"]=TheUser.CurrentSecureSessionID.ToString();
LoginGoodData["agent_access"]="M"; LoginGoodData["agent_access"]="M";
LoginGoodData["start_location"]=requestData["start"]; LoginGoodData["start_location"]=requestData["start"];
LoginGoodData["global_textures"]=GlobalTextures; LoginGoodData["global_textures"]=GlobalTextures;
@ -168,7 +168,7 @@ namespace OpenGridServices
response.SendChunked=false; response.SendChunked=false;
System.IO.Stream body = request.InputStream; System.IO.Stream body = request.InputStream;
System.Text.Encoding encoding = request.ContentEncoding; System.Text.Encoding encoding = System.Text.Encoding.UTF8;
System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
string requestBody = reader.ReadToEnd(); string requestBody = reader.ReadToEnd();
@ -191,11 +191,9 @@ namespace OpenGridServices
} }
byte[] buffer = System.Text.Encoding.Unicode.GetBytes(responseString); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
System.IO.Stream output = response.OutputStream; System.IO.Stream output = response.OutputStream;
response.SendChunked=false; response.SendChunked=false;
encoding = System.Text.Encoding.UTF8;
response.ContentEncoding = encoding;
response.ContentLength64=buffer.Length; response.ContentLength64=buffer.Length;
output.Write(buffer,0,buffer.Length); output.Write(buffer,0,buffer.Length);
output.Close(); output.Close();

View File

@ -167,7 +167,7 @@ namespace OpenGridServices
GridReqParams["authkey"]=SendKey; GridReqParams["authkey"]=SendKey;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(GridReqParams); SendParams.Add(GridReqParams);
XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info",GridReqParams); XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info",SendParams);
XmlRpcResponse GridResp = GridReq.Send(GridURL,3000); XmlRpcResponse GridResp = GridReq.Send(GridURL,3000);