fix %searchquote on unicode strings

This commit is contained in:
Romain Bignon 2014-08-07 14:53:21 +02:00
commit 431e0f2b48

View file

@ -309,14 +309,14 @@ class Boobot(SingleServerIRCBot):
def cmd_searchquote(self, nick, channel, text): def cmd_searchquote(self, nick, channel, text):
try: try:
pattern = re.compile(text, re.IGNORECASE) pattern = re.compile(to_unicode(text), re.IGNORECASE|re.UNICODE)
except Exception as e: except Exception as e:
self.send_message(str(e), channel) self.send_message(str(e), channel)
return return
quotes = [] quotes = []
for quote in self.storage.get(channel, 'quotes', default=[]): for quote in self.storage.get(channel, 'quotes', default=[]):
if pattern.search(quote['text']): if pattern.search(to_unicode(quote['text'])):
quotes.append(quote) quotes.append(quote)
try: try: