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

irc: Fix random UnicodeDecodeErrors #570

Merged
merged 1 commit into from
Dec 28, 2015

Conversation

mrshu
Copy link
Member

@mrshu mrshu commented Dec 27, 2015

Signed-off-by: mr.Shu [email protected]


Note that this should fix #569.

* In errbotio#569 it was reported that `UnicodeDecodeError`s are thrown randomly
  when the IRC backend is used. This commit tries to resolve this
  situation by using a replacement character for unrecognized byte
  sequences as described at https://pypi.python.org/pypi/irc

Signed-off-by: mr.Shu <[email protected]>
# Decode all input to UTF-8, but use a replacement character for
# unrecognized byte sequences
# (as described at https://pypi.python.org/pypi/irc)
self.connection.buffer_class.errors = 'replace'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@perlop Would you find this sufficient? I realize that your issue #569 suggested that all input that is impossible to decode should be ignored -- this seems like a bit more robust solution.

@zoni
Copy link
Member

zoni commented Dec 28, 2015

I think this is a sane thing to do. With no way to reliably determine the used encoding, assuming utf-8 seems the best bet as it is slowly becoming the de-facto encoding used for interoperability.

zoni added a commit that referenced this pull request Dec 28, 2015
@zoni zoni merged commit 2f1e1ef into errbotio:master Dec 28, 2015
zoni added a commit that referenced this pull request Dec 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore all input that cannot be decoded
2 participants