diff --git a/Content.Client/ADT/Administration/ExportManager.cs b/Content.Client/ADT/Administration/ExportManager.cs index 190f577a27a..c2d2e96b85f 100644 --- a/Content.Client/ADT/Administration/ExportManager.cs +++ b/Content.Client/ADT/Administration/ExportManager.cs @@ -21,7 +21,7 @@ public override async void Load(ExportYmlMessage msg) if (data != null) { - await stream.WriteAsync(Encoding.ASCII.GetBytes(data)); + await stream.WriteAsync(Encoding.UTF8.GetBytes(data)); await stream.FlushAsync(); await stream.DisposeAsync(); return; diff --git a/Content.Shared/ADT/Administration/ExportMessage.cs b/Content.Shared/ADT/Administration/ExportMessage.cs index ce8b4fcfe8b..b9b6fff252f 100644 --- a/Content.Shared/ADT/Administration/ExportMessage.cs +++ b/Content.Shared/ADT/Administration/ExportMessage.cs @@ -1,3 +1,4 @@ +using System.Text; using Lidgren.Network; using Robust.Shared.Network; using Robust.Shared.Serialization; @@ -12,11 +13,21 @@ public sealed class ExportYmlMessage : NetMessage public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer) { - Data = buffer.ReadString(); + // Read the length of the byte array + int length = buffer.ReadInt32(); + // Read the byte array + byte[] dataBytes = buffer.ReadBytes(length); + // Decode the byte array to a string using UTF-8 encoding + Data = Encoding.UTF8.GetString(dataBytes); } public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer) { - buffer.Write(Data); + // Encode the string to a byte array using UTF-8 encoding + byte[] dataBytes = Encoding.UTF8.GetBytes(Data); + // Write the length of the byte array + buffer.Write(dataBytes.Length); + // Write the byte array + buffer.Write(dataBytes); } }