Where possible, use the system Encoding.ASCII and Encoding.UTF8 rather than constructing fresh copies.

The encodings are thread-safe and already used in such a manner in other places.
This isn't done where Byte Order Mark output is suppressed, since Encoding.UTF8 is constructed to output the BOM.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-07-11 22:54:22 +01:00
parent 9c89ad9154
commit 916e3bf886
20 changed files with 52 additions and 81 deletions

View File

@@ -425,10 +425,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
try
{
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
string jsondata = SLUtil.ParseNotecardToString(enc.GetString(a.Data));
int result = m_store.SetValue(storeID,path,jsondata,true) ? 1 : 0;
m_comms.DispatchReply(scriptID,result,"",reqID.ToString());
string jsondata = SLUtil.ParseNotecardToString(Encoding.UTF8.GetString(a.Data));
int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0;
m_comms.DispatchReply(scriptID,result, "", reqID.ToString());
return;
}
catch (Exception e)