BytexDigital / BytexDigital.BattlEye.Rcon

A simple to use RCON library for BattlEye
Apache License 2.0
11 stars 9 forks source link

Cyrillic support #3

Closed EgoBrainProgrammer closed 4 years ago

EgoBrainProgrammer commented 4 years ago

The library do not support cyrillic symbols.

RyanTT commented 4 years ago

I believe this is due to the RCON protocol only utilizing ASCII, so it might be I can't do anything about it. Is there a different library or tool that's capable of handling cyrillic?

EgoBrainProgrammer commented 4 years ago

Of course have. Check it out. https://github.com/marceldev89/BattleNET This library can to handle cyrillic. But i have issues with connection to the server in DOTNET CORE. But your library has connection fine in DOT NET CORE.

RyanTT commented 4 years ago

I see, please try the latest dev branch commit d382e4fc45794b4bdbe57c6786b55416f40a4dd8

EgoBrainProgrammer commented 4 years ago

I see, please try the latest dev branch commit d382e4f

Hi. I am using your library from nuget. How to do update and get last commit?

PM> Update-Package BytexDigital.BattlEye.Rcon No package updates are available from the current package source for project

EgoBrainProgrammer commented 4 years ago

Please compile release version and public it on NuGet.

EgoBrainProgrammer commented 4 years ago

Ok. F... the NuGet. I just pull your dev branch and include sources to my solution. So getting this error:

Unhandled exception. System.NotSupportedException: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

RyanTT commented 4 years ago

You can find the pre-release build here https://www.nuget.org/packages/BytexDigital.BattlEye.Rcon/1.0.2-beta.1

EgoBrainProgrammer commented 4 years ago

I solve 1251 issue. I am suggest you to use UTF8Encoding class instead Encoding.

` using System.Text;

namespace BytexDigital.BattlEye.Rcon { public class StringEncoder { //private readonly Encoding _encoding = Encoding.GetEncoding(1252); private readonly UTF8Encoding utf8string = new UTF8Encoding();

    //public byte[] GetBytes(string message) => _encoding.GetBytes(message);
    //public string GetString(byte[] bytes) => _encoding.GetString(bytes);
    public byte[] GetBytes(string message) => utf8string.GetBytes(message);
    public string GetString(byte[] bytes) => utf8string.GetString(bytes);
}

} `

This code works. Tested with cyrillic and chinese.

RyanTT commented 4 years ago

You can now use the nuget beta build https://www.nuget.org/packages/BytexDigital.BattlEye.Rcon/1.0.2-beta.2