From 387e9f7a7faeb412054383080afc3507a1522746 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 2 Oct 2009 18:31:08 -0700 Subject: [PATCH] * Creates Util.UTF8 and switches some references of Encoding.UTF8 to Util.UTF8 (not all references were switched since not all OpenSim libraries reference OpenSim.Framework) * Shrinks the largest in-memory object, the LLRAW.HeightmapLookupValue struct (only used for exporting to LLRAW terrain files), to the minimum possible size. This seems to have the odd side effect of cutting the size of the two double[256,256] terrain objects in half. Possibly an alignment optimization? --- OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | 4 ++-- OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs | 3 ++- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 2 +- OpenSim/Data/SQLite/SQLiteRegionData.cs | 14 +++++++++----- OpenSim/Framework/AssetLandmark.cs | 2 +- OpenSim/Framework/Capabilities/LLSD.cs | 4 ++-- .../Framework/Capabilities/LLSDStreamHandler.cs | 2 +- .../Framework/Communications/XMPP/XmppWriter.cs | 2 +- .../Configuration/HTTP/HTTPConfiguration.cs | 2 +- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- OpenSim/Framework/Util.cs | 12 +++++++----- OpenSim/Region/Application/OpenSimBase.cs | 6 +++--- .../Region/ClientStack/LindenUDP/LLClientView.cs | 4 ++-- .../Agent/TextureSender/J2KDecoderModule.cs | 4 ++-- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 4 ++-- .../CoreModules/World/Terrain/FileLoaders/LLRAW.cs | 10 +++++----- OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 2 +- .../Region/Framework/Scenes/RegionStatsHandler.cs | 2 +- OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 2 +- .../Server/IRCClientView.cs | 4 ++-- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 4 ++-- .../World/TreePopulator/TreePopulatorModule.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- OpenSim/Server/Base/ServerUtils.cs | 2 +- .../Server/Handlers/Neighbour/NeighbourHandlers.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 27 files changed, 55 insertions(+), 48 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 1e3539f6a3..7db705e958 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs @@ -163,7 +163,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory get { return Plugin.RequestId; } } - internal static Encoding Encoding = Encoding.UTF8; + internal static Encoding Encoding = Util.UTF8; /// /// Version control for REST implementation. This @@ -435,7 +435,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory try { byte[] encData_byte = new byte[str.Length]; - encData_byte = Encoding.UTF8.GetBytes(str); + encData_byte = Util.UTF8.GetBytes(str); return Convert.ToBase64String(encData_byte); } catch diff --git a/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs b/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs index 9abb0c882e..283fa2e134 100644 --- a/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs +++ b/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs @@ -45,7 +45,8 @@ namespace OpenSim.ApplicationPlugins.Rest { } - public RestXmlWriter(Stream stream) : this(stream, Encoding.UTF8) + public RestXmlWriter(Stream stream) + : this(stream, Encoding.UTF8) { } diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 180f5e087f..603ef579d5 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -886,7 +886,7 @@ namespace OpenSim.Client.MXP.ClientStack chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid; chatActionEvent.ActionFragment.ObservationRadius = 180.0f; chatActionEvent.ActionFragment.ExtensionDialect = "TEXT"; - chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message)); + chatActionEvent.SetPayloadData(Util.UTF8.GetBytes(message)); Session.Send(chatActionEvent); } diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index ea076fe657..a3ae6ea3dc 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -581,13 +581,17 @@ namespace OpenSim.Data.SQLite if (row.Read()) { // TODO: put this into a function - MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]); - BinaryReader br = new BinaryReader(str); - for (int x = 0; x < (int)Constants.RegionSize; x++) + using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"])) { - for (int y = 0; y < (int)Constants.RegionSize; y++) + using (BinaryReader br = new BinaryReader(str)) { - terret[x, y] = br.ReadDouble(); + for (int x = 0; x < (int)Constants.RegionSize; x++) + { + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + terret[x, y] = br.ReadDouble(); + } + } } } rev = (int) row["Revision"]; diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index 7c87c34b22..fd7a2cd184 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs @@ -49,7 +49,7 @@ namespace OpenSim.Framework private void InternData() { - string temp = Encoding.UTF8.GetString(Data).Trim(); + string temp = Util.UTF8.GetString(Data).Trim(); string[] parts = temp.Split('\n'); int.TryParse(parts[0].Substring(17, 1), out Version); UUID.TryParse(parts[1].Substring(10, 36), out RegionID); diff --git a/OpenSim/Framework/Capabilities/LLSD.cs b/OpenSim/Framework/Capabilities/LLSD.cs index 84f43c129d..eec9e615a9 100644 --- a/OpenSim/Framework/Capabilities/LLSD.cs +++ b/OpenSim/Framework/Capabilities/LLSD.cs @@ -112,7 +112,7 @@ namespace OpenSim.Framework.Capabilities writer.Close(); - return Encoding.UTF8.GetBytes(sw.ToString()); + return Util.UTF8.GetBytes(sw.ToString()); } /// @@ -329,7 +329,7 @@ namespace OpenSim.Framework.Capabilities reader.Read(); FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces); - byte[] inp = Encoding.UTF8.GetBytes(reader.ReadString()); + byte[] inp = Util.UTF8.GetBytes(reader.ReadString()); ret = b64.TransformFinalBlock(inp, 0, inp.Length); break; } diff --git a/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs index df48b35d9e..7aaa99403b 100644 --- a/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs @@ -47,7 +47,7 @@ namespace OpenSim.Framework.Capabilities public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - //Encoding encoding = Encoding.UTF8; + //Encoding encoding = Util.UTF8; //StreamReader streamReader = new StreamReader(request, false); //string requestBody = streamReader.ReadToEnd(); diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs index b52eda70b1..415d808c2f 100644 --- a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs +++ b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework.Communications.XMPP { } - public XMPPWriter(IOStream stream) : this(stream, Encoding.UTF8) + public XMPPWriter(IOStream stream) : this(stream, Util.UTF8) { } diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 318d2c3eef..3dce578193 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -77,7 +77,7 @@ namespace OpenSim.Framework.Configuration.HTTP count = resStream.Read(buf, 0, buf.Length); if (count != 0) { - tempString = Encoding.UTF8.GetString(buf, 0, count); + tempString = Util.UTF8.GetString(buf, 0, count); sb.Append(tempString); } } while (count > 0); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 771ae05437..f314d64d40 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -965,7 +965,7 @@ namespace OpenSim.Framework.Servers.HttpServer } // response.ContentType = "application/llsd+json"; - // return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); + // return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); response.ContentType = "application/llsd+xml"; return OSDParser.SerializeLLSDXmlBytes(llsdResponse); } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 58344f30c8..59159a88ad 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -69,7 +69,9 @@ namespace OpenSim.Framework public static readonly Regex UUIDPattern = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); - + + public static Encoding UTF8 = Encoding.UTF8; + /// /// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards) /// @@ -432,7 +434,7 @@ namespace OpenSim.Framework output.Append(": "); } - output.Append(CleanString(Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1))); + output.Append(CleanString(Util.UTF8.GetString(bytes, 0, bytes.Length - 1))); } else { @@ -793,7 +795,7 @@ namespace OpenSim.Framework public static string Compress(string text) { - byte[] buffer = Encoding.UTF8.GetBytes(text); + byte[] buffer = Util.UTF8.GetBytes(text); MemoryStream memory = new MemoryStream(); using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true)) { @@ -827,7 +829,7 @@ namespace OpenSim.Framework decompressor.Read(buffer, 0, buffer.Length); } - return Encoding.UTF8.GetString(buffer); + return Util.UTF8.GetString(buffer); } } @@ -1099,7 +1101,7 @@ namespace OpenSim.Framework { byte[] data = new byte[length]; stream.Read(data, 0, length); - string strdata = Encoding.UTF8.GetString(data); + string strdata = Util.UTF8.GetString(data); OSDMap args = null; OSD buffer; buffer = OSDParser.DeserializeJson(strdata); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7bc0b77c4b..6b6cb85a5e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -699,7 +699,7 @@ namespace OpenSim public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - return Encoding.UTF8.GetBytes("OK"); + return Util.UTF8.GetBytes("OK"); } public string ContentType @@ -736,7 +736,7 @@ namespace OpenSim public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); + return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); } public string ContentType @@ -777,7 +777,7 @@ namespace OpenSim public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); + return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); } public string ContentType diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 43d29fdd05..3f90004b60 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4748,7 +4748,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Hashtable mp = (Hashtable)simMapProfiles[iii]; mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock(); - mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]); + mbReply.Data[iii].Name = Util.UTF8.GetBytes((string)mp["name"]); mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]); mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]); mbReply.Data[iii].MapImageID = new UUID((string)mp["map-image-id"]); @@ -7338,7 +7338,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion - string mapName = Encoding.UTF8.GetString(map.NameData.Name, 0, + string mapName = Util.UTF8.GetString(map.NameData.Name, 0, map.NameData.Name.Length - 1); handlerMapNameRequest = OnMapNameRequest; if (handlerMapNameRequest != null) diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index a0f359b629..7456e8c04f 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -257,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); } - layerDecodeAsset.Data = Encoding.UTF8.GetBytes(stringResult.ToString()); + layerDecodeAsset.Data = Util.UTF8.GetBytes(stringResult.ToString()); #endregion Serialize Layer Data @@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { #region Deserialize Layer Data - string readResult = Encoding.UTF8.GetString(layerDecodeAsset.Data); + string readResult = Util.UTF8.GetString(layerDecodeAsset.Data); string[] lines = readResult.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); if (lines.Length == 0) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 50d7c97ae4..45e724db18 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest // Encode outbound data if (OutboundBody.Length > 0) { - byte[] data = Encoding.UTF8.GetBytes(OutboundBody); + byte[] data = Util.UTF8.GetBytes(OutboundBody); Request.ContentLength = data.Length; Stream bstream = Request.GetRequestStream(); @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest if (count != 0) { // translate from bytes to ASCII text - tempString = Encoding.UTF8.GetString(buf, 0, count); + tempString = Util.UTF8.GetString(buf, 0, count); // continue building the string sb.Append(tempString); diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs index 3eb7cd20ef..a70ef13ed0 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs @@ -36,10 +36,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders { public struct HeightmapLookupValue : IComparable { - public int Index; - public double Value; + public ushort Index; + public float Value; - public HeightmapLookupValue(int index, double value) + public HeightmapLookupValue(ushort index, float value) { Index = index; Value = value; @@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders { for (int j = 0; j < 256; j++) { - LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue(i + (j * 256), ((double)i * ((double)j / 128.0d))); + LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue((ushort)(i + (j * 256)), (float)((double)i * ((double)j / 128.0d))); } } Array.Sort(LookupHeightTable); @@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders // The lookup table is pre-sorted, so we either find an exact match or // the next closest (smaller) match with a binary search - index = Array.BinarySearch(LookupHeightTable, new HeightmapLookupValue(0, t)); + index = Array.BinarySearch(LookupHeightTable, new HeightmapLookupValue(0, (float)t)); if (index < 0) index = ~index - 1; diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 080bd5aea6..4df9094644 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -352,7 +352,7 @@ namespace OpenSim.Region.DataSnapshot m_log.WarnFormat("[DATASNAPSHOT]: Unable to decode reply from data service. Ignoring. {0}", e.StackTrace); } // This is not quite working, so... - // string responseStr = Encoding.UTF8.GetString(response); + // string responseStr = Util.UTF8.GetString(response); m_log.Info("[DATASNAPSHOT]: data service notified: " + url); } diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index 7c02f9ab6b..6055384fd6 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - return Encoding.UTF8.GetBytes(Report()); + return Util.UTF8.GetBytes(Report()); } public string ContentType diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 8209ff690a..ca6210d029 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs @@ -172,7 +172,7 @@ namespace OpenSim.Region.Framework.Scenes public string SaveToXmlString() { XmlWriterSettings settings = new XmlWriterSettings(); - settings.Encoding = Encoding.UTF8; + settings.Encoding = Util.UTF8; using (StringWriter sw = new StringWriter()) { using (XmlWriter writer = XmlWriter.Create(sw, settings)) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 57f5d294c9..a31cbae362 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server { m_log.Info("[IRCd] Sending >>> " + command); - byte[] buf = Encoding.UTF8.GetBytes(command + "\r\n"); + byte[] buf = Util.UTF8.GetBytes(command + "\r\n"); m_client.GetStream().BeginWrite(buf, 0, buf.Length, SendComplete, null); } @@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server byte[] buf = new byte[8]; // RFC1459 defines max message size as 512. int count = m_client.GetStream().Read(buf, 0, buf.Length); - string line = Encoding.UTF8.GetString(buf, 0, count); + string line = Util.UTF8.GetString(buf, 0, count); strbuf += line; diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 65c5274a57..f9dfc0d50f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -527,7 +527,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice if (method == "POST") { - byte[] contentreq = Encoding.UTF8.GetBytes(body); + byte[] contentreq = Util.UTF8.GetBytes(body); forwardreq.ContentLength = contentreq.Length; Stream reqStream = forwardreq.GetRequestStream(); reqStream.Write(contentreq, 0, contentreq.Length); @@ -535,7 +535,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice } HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); - Encoding encoding = Encoding.UTF8; + Encoding encoding = Util.UTF8; StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding); fwdresponsestr = fwdresponsestream.ReadToEnd(); fwdresponsecontenttype = fwdrsp.ContentType; diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index d4bba1009d..b6021a96a7 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -539,7 +539,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator { XmlSerializer xs = new XmlSerializer(typeof(Copse)); - using (XmlTextWriter writer = new XmlTextWriter(fileName, System.Text.Encoding.UTF8)) + using (XmlTextWriter writer = new XmlTextWriter(fileName, Util.UTF8)) { writer.Formatting = Formatting.Indented; xs.Serialize(writer, obj); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ba426782c8..264d585737 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7064,7 +7064,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api try { byte[] encData_byte = new byte[str.Length]; - encData_byte = Encoding.UTF8.GetBytes(str); + encData_byte = Util.UTF8.GetBytes(str); string encodedData = Convert.ToBase64String(encData_byte); return encodedData; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a077..f80dd51983 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1457,7 +1457,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " + textLength.ToString() + "\n" + notecardData + "}\n"; - asset.Data = Encoding.UTF8.GetBytes(notecardData); + asset.Data = Util.UTF8.GetBytes(notecardData); World.AssetService.Store(asset); // Create Task Entry diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0a36bbee14..6e8ead09bf 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -87,7 +87,7 @@ namespace OpenSim.Server.Base public static byte[] SerializeResult(XmlSerializer xs, object data) { MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); + XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8); xw.Formatting = Formatting.Indented; xs.Serialize(xw, data); xw.Flush(); diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index c0933a8607..7aedc1afab 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -156,7 +156,7 @@ namespace OpenSim.Server.Handlers.Neighbour httpResponse.StatusCode = (int)HttpStatusCode.OK; - return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); + return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); } } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 822edcbc0c..3da72c7bd7 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation httpResponse.StatusCode = (int)HttpStatusCode.OK; - return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); + return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); } }