Closed Aens closed 7 years ago
Can you give me a raw byte string from the original ts3 response I can work with? (I don't have the android client, so I need some test data :))
For the moment, you can try to change the line in the py-ts3 library to:
val = val.decode(errors="ignore")
This may help, but it's not a long term solution.
I'm not sure how to do it, so I added 4 prints. First, in my own code I did throw 2 prints if this error is found, the results were:
Print 1: print(binascii.unhexlify(str(event.parsed)))
Result of print 1: b'\xc0\x80'
Print 2: print("Error for the programmer: "+str(e)+" at:"+str(event.parsed))
Result of print 2: Error for the programmer: Non-hexadecimal digit found at:[{'client_is_priority_speaker': '0', 'client_channel_group_inherited_channel_id': '1', 'client_output_muted': '0', 'client_needed_serverquery_view_power': '75', 'client_flag_avatar': 'dcac20705cf72fe59516ff65b41484d4', 'client_input_hardware': '1', 'client_is_talker': '0', 'client_input_muted': '0', 'client_nickname': 'Fuse1', 'client_channel_group_id': '13', 'client_unique_identifier': 'cVjN2i5rDjo0KmpshrNMeMAUxjU=', 'client_talk_request_msg': '', 'client_outputonly_muted': '0', 'client_type': '0', 'client_badges': '', 'client_away_message': '', 'client_database_id': '7', 'client_nickname_phonetic': '', 'client_servergroups': '23,50,73', 'client_output_hardware': '1', 'client_unread_messages': '0', 'client_talk_request': '0', 'client_country': 'ES', 'client_talk_power': '75', 'ctid': '1', 'client_away': '0', 'cfid': '0', 'client_is_channel_commander': '0', 'client_is_recording': '0', 'reasonid': '0', 'client_meta_data': '', 'clid': '511', 'client_icon_id': '0', 'client_description': 'Doua Ayame'}]
At the same time, on on your library I did added 2 prints as it follows:
try:
key = key.decode()
val = val.decode()
except UnicodeDecodeError as err:
print(val) #as Print3
print(binascii.unhexlify(val)) #as Print4
# Todo: - Should we simply ignore decode errors?
# - Is decoding reasonable?
raise TS3ParserError(self, err)
Print 3 apparently didn't yield any error, and it's likely to be what printed b'\xc0\x80'
(not sure it was the Print 1). But the print4 gave me this error:
Print 4 error: binascii.Error: Non-hexadecimal digit found
And then the script starts dying.
Traceback (most recent call last):
File "D:\Khronos\web-enlaces-rapidos\Bot TS3\ts3\response.py", line 235, in _parse_property
val = val.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte
Finally, this also happens at some point, not sure where:
Print: print(binascii.unhexlify(str(event.parsed)))
Error: binascii.Error: Odd-length string
Comparing my previous post and this one now, it appears it always fails at starting strings of 0xc0 or \xc0. I know nothing about Encoding or Decoding or I'd try to fix it myself. Sorry if the information is confusing.
I'm sorry it took so long for me to respond, I have to learn a lot in the moment. I will label this issue help wanted in the hope some one else sees it and has some time to fix it.
I can not reproduce the bug with my phone. (TS3 android client: 3.0.23, android version: 5.1.1). I tested the textserver, textchannel and server events.
Do all of your android clients cause this bug? I'm a clueless at the moment.
I get the same error for some Android users. Is there any chance you could add the errors="ignore"
as an option so that I won't have to play around with changing my app 😝 ?
From our testing, it appears to happen when requesting the 'clientinfo' of an android client, it returns .. client_default_channel=\xc0\x80 ..
if there is no default channel specified. Explicitly defining a default channel seems to stop the crash.
To me it looks like an android client bug but it would be good if these kinds of client errors are caught here too because IMO it's not always safe to assume the connecting clients are sane
UnicodeDecodeError(s) will be ignored from now on, but logged as warning. So I think I can close this issue finally :).
The issue has been reported and hopefully it gets fixed in the android client soon: http://forum.teamspeak.com/threads/128381-Android-Client-sending-malformed-server-query-data
Hi! as you might know, I managed to built a Bot that monitorize events in teamspeak to being able to answer to chat commands. However, it's giving me lot of problems with Android users.
First, if you're subscribed to notifycliententerviews, when an Android user joins the server, I get the error:
The response could not be parsed! Desc: {}
I tried to bypass that error and get where it fails, and this happens when an android user sends a message:
If you want to know how I'm doing it: https://github.com/Aens/Ts3PyBot/blob/master/Ts3PyBot.py