From cc56645cf972d6e92b2f3a9a31936e1e35aa66f3 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 16 Jul 2013 19:54:10 +0000 Subject: [PATCH] Filter: Fix @unhexlify for Python 3. --- plugins/Filter/plugin.py | 3 ++- plugins/Filter/test.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/Filter/plugin.py b/plugins/Filter/plugin.py index b1f5137ea..09d66218a 100644 --- a/plugins/Filter/plugin.py +++ b/plugins/Filter/plugin.py @@ -196,7 +196,8 @@ class Filter(callbacks.Plugin): must be a string of hexadecimal digits. """ try: - irc.reply(self._hex_decoder(text.encode('utf8'))[0].decode('utf8')) + irc.reply(self._hex_decoder(text.encode('utf8'))[0] + .decode('utf8', 'replace')) except TypeError: irc.error(_('Invalid input.')) unhexlify = wrap(unhexlify, ['text']) diff --git a/plugins/Filter/test.py b/plugins/Filter/test.py index 1840a311c..fdea060db 100644 --- a/plugins/Filter/test.py +++ b/plugins/Filter/test.py @@ -102,6 +102,7 @@ class FilterTest(ChannelPluginTestCase): def testHexlifyUnhexlify(self): for s in map(str, range(1000, 1010)): self.assertResponse('unhexlify [hexlify %s]' % s, s) + self.assertNotError('unhexlify ff') def testScramble(self): s = 'the recalcitrant jamessan tests his scramble function'