From d8a787bd89eb05d417a5abc37ffebe8ed73db6c5 Mon Sep 17 00:00:00 2001 From: dr scofield (aka dirk husemann) Date: Tue, 8 Sep 2009 17:53:28 +0200 Subject: fix: unicode notecards not surviving script treatment (fixes #4119 --- perhaps). --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++---- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f261c16..017a6f6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9477,8 +9477,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - System.Text.ASCIIEncoding enc = - new System.Text.ASCIIEncoding(); + System.Text.UTF8Encoding enc = + new System.Text.UTF8Encoding(); string data = enc.GetString(a.Data); //m_log.Debug(data); NotecardCache.Cache(id, data); @@ -9539,8 +9539,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - System.Text.ASCIIEncoding enc = - new System.Text.ASCIIEncoding(); + System.Text.UTF8Encoding enc = + new System.Text.UTF8Encoding(); string data = enc.GetString(a.Data); //m_log.Debug(data); NotecardCache.Cache(id, data); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index bca019b..726b37a 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.ASCII.GetBytes(notecardData); + asset.Data = Encoding.UTF8.GetBytes(notecardData); World.AssetService.Store(asset); // Create Task Entry @@ -1522,7 +1522,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AssetBase a = World.AssetService.Get(assetID.ToString()); if (a != null) { - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); string data = enc.GetString(a.Data); NotecardCache.Cache(assetID, data); } @@ -1575,7 +1575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AssetBase a = World.AssetService.Get(assetID.ToString()); if (a != null) { - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); string data = enc.GetString(a.Data); NotecardCache.Cache(assetID, data); } @@ -1632,7 +1632,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AssetBase a = World.AssetService.Get(assetID.ToString()); if (a != null) { - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); string data = enc.GetString(a.Data); NotecardCache.Cache(assetID, data); } -- cgit v1.1 From 62358014ed59136cfd1d452f08171a0bc32612cf Mon Sep 17 00:00:00 2001 From: dr scofield (aka dirk husemann) Date: Wed, 9 Sep 2009 08:28:13 +0200 Subject: reformatting. --- .../Shared/Api/Implementation/LSL_Api.cs | 35 +++++++++++----------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 017a6f6..02befda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9524,29 +9524,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (NotecardCache.IsCached(assetID)) { - AsyncCommands. - DataserverPlugin.DataserverReply(assetID.ToString(), - NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); + AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(), + NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); ConditionalScriptSleep(100); return tid.ToString(); } WithNotecard(assetID, delegate (UUID id, AssetBase a) - { - if (a == null || a.Type != 7) - { - ShoutError("Notecard '" + name + "' could not be found."); - return; - } - - System.Text.UTF8Encoding enc = - new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - //m_log.Debug(data); - NotecardCache.Cache(id, data); - AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), - NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); - }); + { + if (a == null || a.Type != 7) + { + ShoutError("Notecard '" + name + "' could not be found."); + return; + } + + System.Text.UTF8Encoding enc = + new System.Text.UTF8Encoding(); + string data = enc.GetString(a.Data); + //m_log.Debug(data); + NotecardCache.Cache(id, data); + AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), + NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); + }); ConditionalScriptSleep(100); return tid.ToString(); -- cgit v1.1