svinota / mdns

mDNS library
GNU General Public License v3.0
21 stars 10 forks source link

Utf-8 error #11

Open titilambert opened 10 years ago

titilambert commented 10 years ago

I get this error when get Pidgin change the status (python 3.4.0 on sailfish OS)

  File "./embedded_libs/mdns/zeroconf.py", line 1138, in run
    self.readers[socket].handle_read()
  File "./embedded_libs/mdns/zeroconf.py", line 1185, in handle_read
    msg = DNSIncoming(data)
  File "./embedded_libs/mdns/zeroconf.py", line 691, in __init__
    self.read_others()
  File "./embedded_libs/mdns/zeroconf.py", line 774, in read_others
    self.read_name())
  File "./embedded_libs/mdns/zeroconf.py", line 842, in read_name
    result = ''.join((result, self.read_utf(off, len) + '.'))
  File "./embedded_libs/mdns/zeroconf.py", line 825, in read_utf
    result = self.data[offset:offset + len].decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
svinota commented 10 years ago

Thanks, fixing

svinota commented 10 years ago

I do not close the issue, since it wasn't fixed normally, but since that commit it should work better. Still looking for a solution for non-utf-8 records.

titilambert commented 10 years ago

Hello ! I get this error now :

  File "/home/nemo/dev/HeySms/heysms/lib/presence_browser.py", line 96, in load_presences
    presences = list_presence_contacts()

  File "/home/nemo/dev/HeySms/heysms/lib/presence_browser.py", line 47, in list_presence_contacts
    logger.debug("Raw entries:" + str(raw_entries))

  File "./embedded_libs/mdns/zeroconf.py", line 639, in __repr__
    return self.to_string(repr(self.text[:27] + b"..."))

TypeError: Can't convert 'bytes' object to str implicitly
svinota commented 10 years ago

python3 :) ok, fixing. Thanks for reporting, without you it wouldn't be fixed ever.