From 59c593f60bf233437544aa391d380fa9ff4d47c1 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 16 Jan 2016 19:36:51 -0600 Subject: [PATCH] transform: use codecs library for rot13 --- dr_botzo/transform/ircplugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dr_botzo/transform/ircplugin.py b/dr_botzo/transform/ircplugin.py index a51c4c1..58d63ea 100644 --- a/dr_botzo/transform/ircplugin.py +++ b/dr_botzo/transform/ircplugin.py @@ -1,6 +1,7 @@ """Assorted text transformations (e.g. rot13).""" import base64 +import codecs from ircbot.lib import Plugin @@ -40,7 +41,8 @@ class Transform(Plugin): """Apply a rot13 method to the text.""" text = match.group(1) - return self.bot.reply(event, text.encode('rot13', 'ignore')) + encoder = codecs.getencoder('rot13') + return self.bot.reply(event, encoder(text)[0]) def handle_base64(self, connection, event, match): """Apply a base64 encoding to the text."""