ParadoxIP150v2 icon indicating copy to clipboard operation
ParadoxIP150v2 copied to clipboard

Problem with UTF8 chars

Open kosztag opened this issue 4 years ago • 1 comments

Hi,

I've just run your app first time and tested. The following problem shown and app is crashed when I entered to a zone has non-ascii character in name.

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 2291, in _thread_main self.loop_forever() File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 1265, in loop_forever rc = self.loop(timeout, max_packets) File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 831, in loop return self.loop_misc() File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 1130, in loop_misc self._message_retry_check() File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 1862, in _message_retry_check self._message_retry_check_actual(self._out_messages, self._out_message_mutex) File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 1850, in _message_retry_check_actual self._send_publish(m.mid, m.topic, m.payload, m.qos, m.retain, m.dup) File "/storage/paradox/ParadoxIP150v2/lib/client.py", line 1688, in _send_publish utopic = topic.encode('utf-8') UnicodeDecodeError: 'ascii' codec can't decode byte 0x9d in position 16: ordinal not in range(128)

kosztag avatar Oct 18 '20 21:10 kosztag

just add the following to the beginning of the script:

reload(sys)
sys.setdefaultencoding('latin-1')

this does not solve the utf-8 decode problem, but at least the sctipt does not crash.

NiOsY avatar Mar 08 '22 18:03 NiOsY