fix remember unicode handling

This commit is contained in:
Ryan Hitchman 2010-02-22 19:01:27 -07:00
parent e706d5aad8
commit 35d0444f13
1 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,7 @@ def get_memory(db, chan, word):
row = db.execute("select data from memory where chan=? and word=lower(?)", row = db.execute("select data from memory where chan=? and word=lower(?)",
(chan, word)).fetchone() (chan, word)).fetchone()
if row: if row:
return row[0].encode('utf8') return row[0]
else: else:
return None return None
@ -32,7 +32,8 @@ def remember(inp, nick='', chan='', db=None):
" (?,lower(?),?,?)", (chan, head, head + ' ' + tail, nick)) " (?,lower(?),?,?)", (chan, head, head + ' ' + tail, nick))
db.commit() db.commit()
if data: if data:
return 'forgetting that %r, remembering this instead.' % data return 'forgetting "%s", remembering this instead.' % \
data.replace('"', "''")
else: else:
return 'done.' return 'done.'