aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadministrator <badmin@ergaster.selvatic.org>2015-01-21 00:52:54 +0100
committerBadministrator <badmin@ergaster.selvatic.org>2015-01-21 00:52:54 +0100
commit2c0b12ef6d5fdfb873c4f63fa3270f916e658ee6 (patch)
tree3cf7b2e1c081e7882d60afec1250b6c87e1cf384
parent83b354c54086ba6dec84fc768fb65bc63136593e (diff)
downloadreebot-2c0b12ef6d5fdfb873c4f63fa3270f916e658ee6.tar.gz
reebot-2c0b12ef6d5fdfb873c4f63fa3270f916e658ee6.zip
fix UnicodeEncodeError
-rwxr-xr-xrbot.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/rbot.py b/rbot.py
index 34d22e4..c035602 100755
--- a/rbot.py
+++ b/rbot.py
@@ -13,6 +13,9 @@ from config import *
13from messages import messages 13from messages import messages
14from reemongo import reemongo 14from reemongo import reemongo
15 15
16reload(sys)
17sys.setdefaultencoding("utf-8")
18
16def main(): 19def main():
17 try: 20 try:
18 db = reemongo() 21 db = reemongo()
@@ -95,12 +98,12 @@ class rBot:
95 98
96 # Loop over feeds entries 99 # Loop over feeds entries
97 for entry in feeds.entries: 100 for entry in feeds.entries:
98 if self.db.log.find_one( { "url" : entry.link.encode( 'utf-8' ) } ) is None: 101 if self.db.log.find_one( { "url" : entry.link } ) is None:
99 msgqueue.append( feed['name'] 102 msgqueue.append( feed['name']
100 + " | " + feeds.feed.title.encode( 'utf-8' ) 103 + " | " + feeds.feed.title
101 + " > " + entry.title.encode( 'utf-8' ) 104 + " > " + entry.title
102 + " : " + entry.link.encode( 'utf-8' ) ) 105 + " : " + entry.link )
103 self.db.log.insert( { "url" : entry.link.decode( 'utf-8' ) } ) 106 self.db.log.insert( { "url" : entry.link } )
104 107
105 while len( msgqueue ) > 0: 108 while len( msgqueue ) > 0:
106 msgq = msgqueue.pop() 109 msgq = msgqueue.pop()