From f710d0c0e3d990892dad885eef7ffeeba315d353 Mon Sep 17 00:00:00 2001 From: Lucas Rosalino Date: Tue, 22 May 2018 18:28:57 -0300 Subject: [PATCH] Use UTF-8 encoded strings for websocket messages It is supported by the rcon protocol. This solves the following issues: - Non-ASCII commands and chat messages sent through the tool being shown as ??? in the client and in the tool's textboxes; - Not being able to connect to servers with Rcon passwords set using non-ASCII characters. (automatically generated or not) --- RconTool/ServerConnection.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RconTool/ServerConnection.cs b/RconTool/ServerConnection.cs index d574148..47f45a1 100644 --- a/RconTool/ServerConnection.cs +++ b/RconTool/ServerConnection.cs @@ -57,11 +57,11 @@ private void Ws_OnOpen(object sender, System.EventArgs e) if (ServerOpen != null) ServerOpen(this); - ws.Send(Encoding.ASCII.GetBytes(Password)); + ws.Send(Encoding.UTF8.GetBytes(Password)); if (connection.serverinfo.sendOnConnect != null) foreach (string sc in connection.serverinfo.sendOnConnect) { - ws.Send(Encoding.ASCII.GetBytes(sc)); + ws.Send(Encoding.UTF8.GetBytes(sc)); } } @@ -81,7 +81,7 @@ public void Command(string cmd) try { - ws.Send(Encoding.ASCII.GetBytes(cmd)); + ws.Send(Encoding.UTF8.GetBytes(cmd)); } catch (Exception) { }