fix to preserve UTF8 encoding in saved script state.

remotes/origin/0.6.7-post-fixes
dr scofield (aka dirk husemann) 2009-09-14 16:14:59 +02:00
parent feccfe4096
commit 19c5c8b98d
1 changed files with 4 additions and 4 deletions

View File

@ -298,14 +298,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
try try
{ {
FileInfo fi = new FileInfo(savedState); FileInfo fi = new FileInfo(savedState);
int size=(int)fi.Length; int size = (int)fi.Length;
if (size < 512000) if (size < 512000)
{ {
using (FileStream fs = File.Open(savedState, using (FileStream fs = File.Open(savedState,
FileMode.Open, FileAccess.Read, FileShare.None)) FileMode.Open, FileAccess.Read, FileShare.None))
{ {
System.Text.ASCIIEncoding enc = System.Text.UTF8Encoding enc =
new System.Text.ASCIIEncoding(); new System.Text.UTF8Encoding();
Byte[] data = new Byte[size]; Byte[] data = new Byte[size];
fs.Read(data, 0, size); fs.Read(data, 0, size);
@ -899,7 +899,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
try try
{ {
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")); FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
Byte[] buf = enc.GetBytes(xml); Byte[] buf = enc.GetBytes(xml);
fs.Write(buf, 0, buf.Length); fs.Write(buf, 0, buf.Length);
fs.Close(); fs.Close();