Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with extended ASCII chars #43

Open
wordsongoku opened this issue Jun 22, 2016 · 11 comments
Open

Problem with extended ASCII chars #43

wordsongoku opened this issue Jun 22, 2016 · 11 comments
Labels

Comments

@wordsongoku
Copy link

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

@marceldev89
Copy link
Owner

Ah, really hoped that #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.

@wordsongoku
Copy link
Author

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. :)

@marceldev89
Copy link
Owner

Changing it to Encoding.Default might break Cyrillic again. Please make
sure that it doesn't do that. 😄
Op 23 jun. 2016 12:16 a.m. schreef "wordiboi" notifications@github.com:

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
#43 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABwfY58vNuVLlTsZElgIADW3vrH_cYD_ks5qObQlgaJpZM4I8KcE
.

@DomiStyle
Copy link
Contributor

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.

@marceldev89
Copy link
Owner

marceldev89 commented Jun 23, 2016

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
Copy link
Owner

@wordiboi, did you give up? 😄

@DomiStyle
Copy link
Contributor

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.

@marceldev89
Copy link
Owner

@wordiboi can you test out the changes made by @DomiStyle? Would be appreciated. 🙂

@wordsongoku
Copy link
Author

wordsongoku commented Nov 26, 2016

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 ;)

@marceldev89
Copy link
Owner

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?

@wordsongoku
Copy link
Author

wordsongoku commented Nov 27, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants