marceldev89 / BattleNET

BattlEye Protocol Library and Client
GNU Lesser General Public License v3.0
76 stars 44 forks source link

UTF-8 support? #6

Closed DomiStyle closed 11 years ago

DomiStyle commented 12 years ago

Hello, I tried tracing down a problem in DaRT that causes russian symbols to not get shown. I tried to see where the problem is and I believe it is in BattleNET. Since it works fine in BERCon I would say RCon is not the problem too, as well as the textbox I am writing to which is already UTF-8. Could you take a look?

marceldev89 commented 12 years ago

Could you provide me with some login details for a (heavy populated) server? I shut down my own server a few weeks ago so I'm not able to test anything at the moment. (You can PM me on the forums if you want to)

DomiStyle commented 12 years ago

Sent you the login details via PM.

marceldev89 commented 12 years ago

Thank you, much appreciated. :)

marceldev89 commented 12 years ago

Tested it both in DaRT and my own and seems to be working as it should. :)

DomiStyle commented 11 years ago

It appears that there is still a problem with the encoding. This time the other way around. When sending a message via BattleNET that contains cyrillic characters like И, Д, Ф and Я it gets displayed as ? ingame. I tested every single step in DaRT and the encoding works fine till I pass the message to BattleNET. I would guess that there is a problem with the encoding in the String2Bytes class. However, it seems like BattlEye doesn't like UTF-8 that much. Atleast it appears that BattleNET gets stuck in the connecting process when I try to use UTF-8. Trying to only encode the command with UTF-8 didn't work very well either. Can't really say if BERCon is able to post cyrillic characters at the moment. I would assume it is able to do so though.

nanomo commented 11 years ago

if the problem it's in the console try setting Console.InputEncoding = Encoding.UTF8 Console.OutputEncoding = Encoding.UTF8

marceldev89 commented 11 years ago

Won't work. See this discussion.

DomiStyle commented 11 years ago

Nope, not a problem with the console. My console is already set to UTF-8 and the font I use in DaRT supports UTF-8. Maybe it's worth asking which encoding they use with BattlEye? Since there are many russian people playing and I saw a few admins writing russian in admin chat already there must be a proper encoding they use.

DomiStyle commented 11 years ago

Changing all encodings to Encoding.GetEncoding(1251) seems to help a little bit. It will properly display cyrillic in console but not ingame.

marceldev89 commented 11 years ago

There has to be some way to make it work. BattlEye is fully capable of sending Cyrillic so I guess it should also be possible to receive it somehow.

ghost commented 11 years ago

Hello? i just wanted to say ho i solve this problem:

In start of BattleNet client:

Console.InputEncoding = Encoding.Default; Console.OutputEncoding = Encoding.UTF8;

And when assembling commands:

command = Encoding.GetEncoding(1252).GetString(Encoding.UTF8.GetBytes(command));

And everytrhing works for me

marceldev89 commented 11 years ago

Hmm I thought I tried that before, converting UTF8 to 1252. I'll see if I can incorporate that into the library. Thanks. :)

ghost commented 11 years ago

@ziellos2k This variant with no changing library, if you can make it in library it will be nice :) I do not have so much time for understanding all code of library so i cannot find where i can change this and solve this issue... sorry for my bad english :)

marceldev89 commented 11 years ago

Reopening this so I don't forget. ^^

DomiStyle commented 11 years ago

Will this be in the next version coming out soon or should I take some time to implement it into DaRT?

marceldev89 commented 11 years ago

Should be in the coming update.

DomiStyle commented 11 years ago

Good to hear. Will wait for the coming update then.