BattleNET icon indicating copy to clipboard operation
BattleNET copied to clipboard

Problem with extended ASCII chars

Open wordsongoku opened this issue 8 years ago β€’ 11 comments

Hey,

thanks for the great library, I love using it. But there is one issue that causes me trouble, it is not possible to handle extended ascii chars with the library, so for example a character like "ΓΏ" is shown as "?". So a player who uses those characters in his nickname can't be handled with our admin tool as his nickname is shown as "????". So from what I get sending and receive the package should be handled a little bit different for situations like that.

Thank You

wordsongoku avatar Jun 22 '16 20:06 wordsongoku

Ah, really hoped that https://github.com/marceldev89/BattleNET/issues/6 fixed it..

I haven't been actively maintaining the library for a while now. And probably won't until things really break. However, you're free to create a pull request. The fix should be done here-ish: https://github.com/marceldev89/BattleNET/blob/master/BattleNET/Helpers.cs#L44.

If you're not interested in providing a fix yourself then it will be a little while until I get around to fixing this.

marceldev89 avatar Jun 22 '16 21:06 marceldev89

Seems that I figured a fix but not able to test it yet. Gonna give it a try later and report back here, from what I get it should be Encoding.Default instead of Encoding.UTF8. :)

wordsongoku avatar Jun 22 '16 22:06 wordsongoku

Changing it to Encoding.Default might break Cyrillic again. Please make sure that it doesn't do that. :smile: Op 23 jun. 2016 12:16 a.m. schreef "wordiboi" [email protected]:

Seems that I figured a fix but not able to test it yet. Gonna give it a try later and report back here, from what I get it should be Encoding.Default instead of Encoding.UTF8. :)

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marceldev89/BattleNET/issues/43#issuecomment-227894294, or mute the thread https://github.com/notifications/unsubscribe/ABwfY58vNuVLlTsZElgIADW3vrH_cYD_ks5qObQlgaJpZM4I8KcE .

marceldev89 avatar Jun 22 '16 22:06 marceldev89

Seems that I figured a fix but not able to test it yet. Gonna give it a try later and report back here, from what I get it should be Encoding.Default instead of Encoding.UTF8. :)

Changing it to Encoding.Default might break Cyrillic again. Please make sure that it doesn't do that. πŸ˜„

Encoding.Default will indeed break Cyrillic again. Make sure you use UTF-8 in any place you output/save data from BattleNET. This means console output but also text field output in forms/WPF applications. When saving to a file or a database you will also need to make sure it gets saved as UTF-8 or you will not be able to retrieve the original message again without making things messy.

DomiStyle avatar Jun 22 '16 22:06 DomiStyle

From what I could find on the web, you'll have to check if the string contains any extended ASCII characters (code page 437) and convert them to UTF8 or 1252 and then return it as UTF8.

marceldev89 avatar Jun 23 '16 12:06 marceldev89

@wordiboi, did you give up? :smile:

marceldev89 avatar Jul 04 '16 21:07 marceldev89

I recently switched over to 1251 encoding because Cyrillic characters were not working correctly in player names. The commit is here, so maybe somebody who uses extended ASCII characters (looking at you @wordiboi) can try it out.

DomiStyle avatar Nov 02 '16 12:11 DomiStyle

@wordiboi can you test out the changes made by @DomiStyle? Would be appreciated. πŸ™‚

marceldev89 avatar Nov 10 '16 14:11 marceldev89

Hi,

yes that's exactly what I did a few months ago to fix this issue for my purposes. I also coded my own battleye tool in c++ meanwhile so I can use it on linux and windows with only a few adjustments. Just wasn't very active on github in the meantime ;)

wordsongoku avatar Nov 26 '16 16:11 wordsongoku

Unless you're talking about a GUI, you did know that BattleNET works fine on Linux using mono, right? ^^

Anyway, doesn't Windows-1251 affect people using the special characters from Windows-1252?

marceldev89 avatar Nov 27 '16 11:11 marceldev89

Yes I know but atleast on my system some of the "infinite loops" inside BattleNET caused stack overflow exceptions and the program crashed, especially when the server was offline and it tried to reconnect for a long time. So e.g. shutting down the server for 30 minutes or just restarting it didn't cause any issue but leaving the server down for more than 1 hr and having the tool trying to reconnect during that period caused stack overflow exceptions.

Anyway, doesn't Windows-1251 affect people using the special characters from Windows-1252?

I'm not sure about that, probably it needs an in-depth look but I didn't run into any situation where it didn't work for me. I was able to track every person regardless how they tried to "manipulate" their ingame name.

EDIT: Just looked at the code I used and I just saw that I used Windows-1252 in the recent months which gave me the perfect result as described above.

wordsongoku avatar Nov 27 '16 15:11 wordsongoku