jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 86 forks source link

UnicodeDecodeError #40

Closed jaraco closed 8 years ago

jaraco commented 8 years ago

Hello. I've written a bot using your very nice IRC library. Up until now, there have no been issues. Today a german used the bot w/xchat on windows and the library throws an exception while decoding lines with umlauts and ß and other unicode chars.

Here's a traceback:

  File "/usr/local/bin/hanabIRC", line 143, in <module>
    bot.start()
  File "/usr/local/lib/python2.7/dist-packages/irc/bot.py", line 266, in start
    super(SingleServerIRCBot, self).start()
  File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 1263, in start
    self.manifold.process_forever()
  File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 280, in process_forever
    self.process_once(timeout)
  File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 261, in process_once
    self.process_data(i)
  File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 218, in process_data
    c.process_data()
  File "/usr/local/lib/python2.7/dist-packages/irc/client.py", line 575, in process_data
    for line in self.buffer:
  File "/usr/local/lib/python2.7/dist-packages/irc/buffer.py", line 94, in lines
    self.handle_exception()
  File "/usr/local/lib/python2.7/dist-packages/irc/buffer.py", line 92, in lines
    yield line.decode(self.encoding, self.errors)
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xdf in position 77: invalid continuation byte

jaraco commented 8 years ago

This happens when the client doesn't use a UTF-8 encoding and instead uses something else. The README provides suggestions on how you can configure your bot to handle these older, less well-behaved clients.


Original comment by: Jason R. Coombs

jaraco commented 8 years ago

Got it. Thanks guys.


Original comment by: Phil Stein

jaraco commented 8 years ago

Issue #41 was marked as a duplicate of this issue.


Original comment by: Jason R. Coombs

jaraco commented 8 years ago

Issue #52 was marked as a duplicate of this issue.


Original comment by: Jason R. Coombs

jaraco commented 8 years ago

Issue #68 was marked as a duplicate of this issue.


Original comment by: Jason R. Coombs