* Converted a large number of ASCII encodings to UTF8.

* We should not be using ASCII anywhere except for legacy compatibility reasons.
* A large number of UTF8 Encoders are being used in places where we should be using Util.StringToField instead. These have been tagged with // ENCODING FAULT
* This should fix Mantis#799 - Japanese Profile Text does not work.
0.6.0-stable
Adam Frisby 2008-03-21 02:26:00 +00:00
parent dc79146d01
commit 7286bd60b0
7 changed files with 20 additions and 13 deletions

View File

@ -329,7 +329,7 @@ namespace OpenSim.Region.Capabilities
reader.Read();
FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
byte[] inp = Encoding.ASCII.GetBytes(reader.ReadString());
byte[] inp = Encoding.UTF8.GetBytes(reader.ReadString());
ret = b64.TransformFinalBlock(inp, 0, inp.Length);
break;
}

View File

@ -74,7 +74,7 @@ namespace OpenSim.Framework.Configuration.HTTP
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Encoding.ASCII.GetString(buf, 0, count);
tempString = Encoding.UTF8.GetString(buf, 0, count);
sb.Append(tempString);
}
} while (count > 0);

View File

@ -84,7 +84,8 @@ namespace OpenSim.Region.ClientStack
private int m_lastPacketsReceived = 0;
private byte[] ZeroOutBuffer = new byte[4096];
private readonly Encoding m_encoding = Encoding.ASCII;
// ENCODING FAULT
private readonly Encoding m_encoding = Encoding.UTF8;
private readonly LLUUID m_agentId;
private readonly uint m_circuitCode;
private int m_moneyBalance;
@ -1165,7 +1166,8 @@ namespace OpenSim.Region.ClientStack
// 6 to 7 items at a time, so let's stick with 6
int MAX_ITEMS_PER_PACKET = 6;
Encoding enc = Encoding.ASCII;
// ENCODING FAULT
Encoding enc = Encoding.UTF8;
uint FULL_MASK_PERMISSIONS = 2147483647;
if (fetchItems)
@ -1336,7 +1338,8 @@ namespace OpenSim.Region.ClientStack
public void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item)
{
Encoding enc = Encoding.ASCII;
// ENCODING FAULT
Encoding enc = Encoding.UTF8;
uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
// TODO: don't create new blocks if recycling an old packet
@ -1378,7 +1381,8 @@ namespace OpenSim.Region.ClientStack
/// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
public void SendInventoryItemCreateUpdate(InventoryItemBase Item)
{
Encoding enc = Encoding.ASCII;
// ENCODING FAULT
Encoding enc = Encoding.UTF8;
uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
// TODO: don't create new blocks if recycling an old packet
@ -2213,7 +2217,8 @@ namespace OpenSim.Region.ClientStack
{
objdata.TextureEntry = textureEntry;
}
Encoding enc = Encoding.ASCII;
// ENCODING FAULT
Encoding enc = Encoding.UTF8;
LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
pos.X = 100f;
objdata.ID = 8880000;
@ -2941,7 +2946,8 @@ namespace OpenSim.Region.ClientStack
}
else
{
Encoding _enc = Encoding.ASCII;
// ENCODING FAULT
Encoding _enc = Encoding.UTF8;
switch (Pack.Type)
{
@ -3989,7 +3995,7 @@ namespace OpenSim.Region.ClientStack
OutPacket(tpStart, ThrottleOutPacketType.Task);
TeleportProgressPacket tpProgress = (TeleportProgressPacket)PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
tpProgress.Info.Message = (new UTF8Encoding()).GetBytes("sending_landmark");
tpProgress.Info.TeleportFlags = 8;
tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
OutPacket(tpProgress, ThrottleOutPacketType.Task);

View File

@ -634,7 +634,8 @@ namespace OpenSim.Region.Environment
public void sendRegionInfoPacket(IClientAPI remote_client)
{
Encoding _enc = Encoding.ASCII;
// ENCODING FAULT
Encoding _enc = Encoding.UTF8;
AgentCircuitData circuitData = remote_client.RequestClientInfo();

View File

@ -328,7 +328,7 @@ namespace OpenSim.Region.Environment.Modules
if (count != 0)
{
// translate from bytes to ASCII text
tempString = Encoding.ASCII.GetString(buf, 0, count);
tempString = Encoding.UTF8.GetString(buf, 0, count);
// continue building the string
sb.Append(tempString);

View File

@ -45,7 +45,8 @@ namespace OpenSim.Region.Environment.Scenes
public partial class SceneObjectGroup : EntityBase
{
private Encoding enc = Encoding.ASCII;
// ENCODING FAULT
private Encoding enc = Encoding.UTF8;
protected SceneObjectPart m_rootPart;

View File

@ -51,7 +51,6 @@ namespace OpenSim.Region.ScriptEngine.Common
{
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// private ASCIIEncoding enc = new ASCIIEncoding();
private ScriptEngineBase.ScriptEngine m_ScriptEngine;
private SceneObjectPart m_host;
private uint m_localID;