From 65f95cfe408e948a7b42e6bbc9bfeb51e31e953e Mon Sep 17 00:00:00 2001 From: Maik Kulbe Date: Mon, 12 May 2014 15:41:58 +0200 Subject: [PATCH] Fixed UTF-8 missing output in shorturl plugin. Closes #21 --- plugins/shorturl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/shorturl.py b/plugins/shorturl.py index 46f3ab5..b52c787 100644 --- a/plugins/shorturl.py +++ b/plugins/shorturl.py @@ -29,9 +29,9 @@ def googl(self, url): return ret def getTitle(self, url): - data = urllib2.urlopen(url=url, timeout=BYTEBOT_HTTP_TIMEOUT) + data = urllib2.urlopen(url=url, timeout=BYTEBOT_HTTP_TIMEOUT) soup = BeautifulSoup(data) - return soup.title.string[:60] + return soup.title.getText().encode('utf-8')[:60] def onPrivmsg(self, irc, msg, channel, user): @@ -47,7 +47,7 @@ def onPrivmsg(self, irc, msg, channel, user): title = '' if title != '': - irc.msg(channel, title.encode('ascii', 'ignore')) + irc.msg(channel, title) irc.msg(channel, '\tURL: %s' % shorturl) else: irc.msg(channel, "URL: %s" % shorturl)