Rather than instantiating a UTF8 encoding everywhere when we want to supress the BOM, use a single Util.UTF8NoBomEncoding.

This class is thread-safe (as evidenced by the provision of the system-wide Encoding.UTF8 which does not suppress BOM on output).
0.7.3-extended
Justin Clark-Casey (justincc) 2012-07-13 01:03:28 +01:00
parent 8f61da0759
commit 89efccaa71
14 changed files with 103 additions and 79 deletions

View File

@ -66,9 +66,7 @@ namespace OpenSim.Framework.Capabilities
TResponse response = m_method(llsdRequest); TResponse response = m_method(llsdRequest);
Encoding encoding = new UTF8Encoding(false); return Util.UTF8NoBomEncoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
} }
} }
} }

View File

@ -41,8 +41,6 @@ namespace OpenSim.Framework.Serialization
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
/// <summary> /// <summary>
/// Binary writer for the underlying stream /// Binary writer for the underlying stream
/// </summary> /// </summary>
@ -73,7 +71,7 @@ namespace OpenSim.Framework.Serialization
/// <param name="data"></param> /// <param name="data"></param>
public void WriteFile(string filePath, string data) public void WriteFile(string filePath, string data)
{ {
WriteFile(filePath, m_utf8Encoding.GetBytes(data)); WriteFile(filePath, Util.UTF8NoBomEncoding.GetBytes(data));
} }
/// <summary> /// <summary>

View File

@ -148,6 +148,7 @@ namespace OpenSim.Framework
} }
public static Encoding UTF8 = Encoding.UTF8; public static Encoding UTF8 = Encoding.UTF8;
public static Encoding UTF8NoBomEncoding = new UTF8Encoding(false);
/// <value> /// <value>
/// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards) /// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)

View File

@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
m_LocalCache[scene.RegionInfo.RegionID].Clear(); m_LocalCache[scene.RegionInfo.RegionID].Clear();
m_LocalCache.Remove(scene.RegionInfo.RegionID); m_LocalCache.Remove(scene.RegionInfo.RegionID);
} }

View File

@ -943,7 +943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
try try
{ {
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
Byte[] buf = (new UTF8Encoding()).GetBytes(xml); Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml);
fs.Write(buf, 0, buf.Length); fs.Write(buf, 0, buf.Length);
fs.Close(); fs.Close();
} }

View File

@ -321,8 +321,7 @@ namespace OpenSim.Server.Handlers.Authentication
private byte[] ResultToBytes(Dictionary<string, object> result) private byte[] ResultToBytes(Dictionary<string, object> result)
{ {
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
} }
} }

View File

@ -121,8 +121,7 @@ namespace OpenSim.Server.Handlers.Avatar
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
return FailureResult(); return FailureResult();

View File

@ -152,10 +152,9 @@ namespace OpenSim.Server.Handlers.Friends
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
//m_log.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
} }
byte[] StoreFriend(Dictionary<string, object> request) byte[] StoreFriend(Dictionary<string, object> request)

View File

@ -226,10 +226,9 @@ namespace OpenSim.Server.Handlers.Grid
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
} }
byte[] GetRegionByUUID(Dictionary<string, object> request) byte[] GetRegionByUUID(Dictionary<string, object> request)
@ -256,9 +255,9 @@ namespace OpenSim.Server.Handlers.Grid
result["result"] = rinfo.ToKeyValuePairs(); result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionByPosition(Dictionary<string, object> request) byte[] GetRegionByPosition(Dictionary<string, object> request)
@ -289,9 +288,9 @@ namespace OpenSim.Server.Handlers.Grid
result["result"] = rinfo.ToKeyValuePairs(); result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionByName(Dictionary<string, object> request) byte[] GetRegionByName(Dictionary<string, object> request)
@ -318,9 +317,9 @@ namespace OpenSim.Server.Handlers.Grid
result["result"] = rinfo.ToKeyValuePairs(); result["result"] = rinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionsByName(Dictionary<string, object> request) byte[] GetRegionsByName(Dictionary<string, object> request)
@ -361,9 +360,9 @@ namespace OpenSim.Server.Handlers.Grid
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionRange(Dictionary<string, object> request) byte[] GetRegionRange(Dictionary<string, object> request)
@ -410,9 +409,9 @@ namespace OpenSim.Server.Handlers.Grid
} }
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetDefaultRegions(Dictionary<string, object> request) byte[] GetDefaultRegions(Dictionary<string, object> request)
@ -440,9 +439,9 @@ namespace OpenSim.Server.Handlers.Grid
} }
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetFallbackRegions(Dictionary<string, object> request) byte[] GetFallbackRegions(Dictionary<string, object> request)
@ -481,9 +480,9 @@ namespace OpenSim.Server.Handlers.Grid
} }
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetHyperlinks(Dictionary<string, object> request) byte[] GetHyperlinks(Dictionary<string, object> request)
@ -511,9 +510,9 @@ namespace OpenSim.Server.Handlers.Grid
} }
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetRegionFlags(Dictionary<string, object> request) byte[] GetRegionFlags(Dictionary<string, object> request)
@ -537,12 +536,11 @@ namespace OpenSim.Server.Handlers.Grid
result["result"] = flags.ToString(); result["result"] = flags.ToString();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
#endregion #endregion
#region Misc #region Misc

View File

@ -117,10 +117,9 @@ namespace OpenSim.Server.Handlers.GridUser
result["result"] = guinfo.ToKeyValuePairs(); result["result"] = guinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
} }
byte[] LoggedOut(Dictionary<string, object> request) byte[] LoggedOut(Dictionary<string, object> request)
@ -189,10 +188,9 @@ namespace OpenSim.Server.Handlers.GridUser
result["result"] = guinfo.ToKeyValuePairs(); result["result"] = guinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
} }
byte[] GetGridUserInfos(Dictionary<string, object> request) byte[] GetGridUserInfos(Dictionary<string, object> request)
@ -231,8 +229,7 @@ namespace OpenSim.Server.Handlers.GridUser
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt)

View File

@ -215,9 +215,9 @@ namespace OpenSim.Server.Handlers.Asset
result["RESULT"] = "False"; result["RESULT"] = "False";
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetInventorySkeleton(Dictionary<string,object> request) byte[] HandleGetInventorySkeleton(Dictionary<string,object> request)
@ -243,9 +243,48 @@ namespace OpenSim.Server.Handlers.Asset
result["FOLDERS"] = sfolders; result["FOLDERS"] = sfolders;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString); }
byte[] HandleGetUserInventory(Dictionary<string, object> request)
{
Dictionary<string, object> result = new Dictionary<string, object>();
UUID principal = UUID.Zero;
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
InventoryCollection icoll = m_InventoryService.GetUserInventory(principal);
if (icoll != null)
{
Dictionary<string, object> folders = new Dictionary<string, object>();
int i = 0;
if (icoll.Folders != null)
{
foreach (InventoryFolderBase f in icoll.Folders)
{
folders["folder_" + i.ToString()] = EncodeFolder(f);
i++;
}
result["FOLDERS"] = folders;
}
if (icoll.Items != null)
{
i = 0;
Dictionary<string, object> items = new Dictionary<string, object>();
foreach (InventoryItemBase it in icoll.Items)
{
items["item_" + i.ToString()] = EncodeItem(it);
i++;
}
result["ITEMS"] = items;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
} }
byte[] HandleGetRootFolder(Dictionary<string,object> request) byte[] HandleGetRootFolder(Dictionary<string,object> request)
@ -259,9 +298,9 @@ namespace OpenSim.Server.Handlers.Asset
result["folder"] = EncodeFolder(rfolder); result["folder"] = EncodeFolder(rfolder);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetFolderForType(Dictionary<string,object> request) byte[] HandleGetFolderForType(Dictionary<string,object> request)
@ -276,9 +315,9 @@ namespace OpenSim.Server.Handlers.Asset
result["folder"] = EncodeFolder(folder); result["folder"] = EncodeFolder(folder);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetFolderContent(Dictionary<string,object> request) byte[] HandleGetFolderContent(Dictionary<string,object> request)
@ -312,9 +351,9 @@ namespace OpenSim.Server.Handlers.Asset
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetFolderItems(Dictionary<string,object> request) byte[] HandleGetFolderItems(Dictionary<string,object> request)
@ -340,9 +379,9 @@ namespace OpenSim.Server.Handlers.Asset
result["ITEMS"] = sitems; result["ITEMS"] = sitems;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleAddFolder(Dictionary<string,object> request) byte[] HandleAddFolder(Dictionary<string,object> request)
@ -504,9 +543,9 @@ namespace OpenSim.Server.Handlers.Asset
result["item"] = EncodeItem(item); result["item"] = EncodeItem(item);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetFolder(Dictionary<string,object> request) byte[] HandleGetFolder(Dictionary<string,object> request)
@ -521,9 +560,9 @@ namespace OpenSim.Server.Handlers.Asset
result["folder"] = EncodeFolder(folder); result["folder"] = EncodeFolder(folder);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetActiveGestures(Dictionary<string,object> request) byte[] HandleGetActiveGestures(Dictionary<string,object> request)
@ -546,9 +585,9 @@ namespace OpenSim.Server.Handlers.Asset
result["ITEMS"] = items; result["ITEMS"] = items;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] HandleGetAssetPermissions(Dictionary<string,object> request) byte[] HandleGetAssetPermissions(Dictionary<string,object> request)
@ -563,11 +602,10 @@ namespace OpenSim.Server.Handlers.Asset
result["RESULT"] = perms.ToString(); result["RESULT"] = perms.ToString();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
}
private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
{ {

View File

@ -199,9 +199,9 @@ namespace OpenSim.Server.Handlers.Presence
result["result"] = pinfo.ToKeyValuePairs(); result["result"] = pinfo.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] GetAgents(Dictionary<string, object> request) byte[] GetAgents(Dictionary<string, object> request)
@ -240,12 +240,11 @@ namespace OpenSim.Server.Handlers.Presence
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
private byte[] SuccessResult() private byte[] SuccessResult()
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();

View File

@ -195,9 +195,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
} }
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
byte[] StoreAccount(Dictionary<string, object> request) byte[] StoreAccount(Dictionary<string, object> request)
@ -353,8 +353,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
private byte[] ResultToBytes(Dictionary<string, object> result) private byte[] ResultToBytes(Dictionary<string, object> result)
{ {
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
UTF8Encoding encoding = new UTF8Encoding(); return Util.UTF8NoBomEncoding.GetBytes(xmlString);
return encoding.GetBytes(xmlString);
} }
} }
} }

View File

@ -132,8 +132,7 @@ namespace OpenSim.Services.Connectors
try try
{ {
strBuffer = OSDParser.SerializeJsonString(args); strBuffer = OSDParser.SerializeJsonString(args);
UTF8Encoding str = new UTF8Encoding(); buffer = Util.UTF8NoBomEncoding.GetBytes(strBuffer);
buffer = str.GetBytes(strBuffer);
} }
catch (Exception e) catch (Exception e)
{ {