fixed non-ASCII chat and IM

afrisby
Jeff Ames 2007-11-08 07:14:46 +00:00
parent 0b4e15bc35
commit fc3e247956
3 changed files with 6 additions and 5 deletions

View File

@ -251,6 +251,7 @@ namespace OpenSim.Region.ClientStack
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
{
Encoding enc = Encoding.ASCII;
Encoding encUTF8 = Encoding.UTF8;
ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
msg.AgentData.AgentID = fromAgent;
msg.AgentData.SessionID = fromAgentSession;
@ -264,7 +265,7 @@ namespace OpenSim.Region.ClientStack
msg.MessageBlock.RegionID = LLUUID.Random();
msg.MessageBlock.Timestamp = timeStamp;
msg.MessageBlock.ToAgentID = toAgent;
msg.MessageBlock.Message = enc.GetBytes(message + "\0");
msg.MessageBlock.Message = encUTF8.GetBytes(message + "\0");
msg.MessageBlock.BinaryBucket = new byte[0];
OutPacket(msg);

View File

@ -83,7 +83,7 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.ChatFromViewer:
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack;
if (Util.FieldToString(inchatpack.ChatData.Message) == "")
if (Helpers.FieldToUTF8String(inchatpack.ChatData.Message) == "")
{
//empty message so don't bother with it
break;
@ -101,7 +101,7 @@ namespace OpenSim.Region.ClientStack
ChatFromViewerArgs args = new ChatFromViewerArgs();
args.Channel = channel;
args.From = fromName;
args.Message = Util.FieldToString(message);
args.Message = Helpers.FieldToUTF8String(message);
args.Type = (ChatTypeEnum) type;
args.Position = fromPos;
@ -114,7 +114,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.ImprovedInstantMessage:
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message);
string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message);
if (OnInstantMessage != null)
{
OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
{
ChatFromViewerArgs args = new ChatFromViewerArgs();
args.Message = Util.FieldToString(message);
args.Message = Helpers.FieldToUTF8String(message);
args.Channel = channel;
args.Type = type;
args.Position = fromPos;