From fc3e247956d11b9e28a1ec0654eb4a7e92d7c91b Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 8 Nov 2007 07:14:46 +0000 Subject: fixed non-ASCII chat and IM --- OpenSim/Region/ClientStack/ClientView.API.cs | 3 ++- OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 6 +++--- OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 14e1b39..c8213fc 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -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); diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 7a778e8..d285d21 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -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, diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index a57041b..74e9a43 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -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; -- cgit v1.1