[Otfbot-svn] r97 - trunk

allo at BerliOS allo
So Jun 10 13:52:29 CEST 2007


Author: allo
Date: 2007-06-10 13:52:28 +0200 (Sun, 10 Jun 2007)
New Revision: 97

Modified:
   trunk/otfbot.py
Log:
encoding fix


Modified: trunk/otfbot.py
===================================================================
--- trunk/otfbot.py	2007-06-10 01:06:59 UTC (rev 96)
+++ trunk/otfbot.py	2007-06-10 11:52:28 UTC (rev 97)
@@ -139,6 +139,7 @@
 		myconfig.set('enabled', 'false', 'main', 'irc.samplenetwork')
 		myconfig.set('enabled', 'false', 'main', 'irc.samplenetwork', '#example')
 		myconfig.set('nickname', 'OtfBot', 'main')
+		myconfig.set('encoding', 'UTF-8', 'main')
 		myconfig.set('pidfile','otfbot.pid','main')
 		
 		file=open(myconfigfile, "w")
@@ -288,11 +289,11 @@
 	def sendmsg(self, channel, msg, encoding="iso-8859-15", fallback="iso-8859-15"):
 		"""msg function, that converts from iso-8859-15 to a encoding given in the config"""
 		try:
-			msg=unicode(msg, encoding).encode(self.getConfig("encoding", "UTF-8"))
+			msg=unicode(msg, encoding).encode(self.getConfig("encoding", "UTF-8", "main"))
 		except UnicodeDecodeError:
 			#self.logger.debug("Unicode Decode Error with String:"+str(msg))
 			#Try with Fallback encoding
-			msg=unicode(msg, fallback).encode(self.getConfig("encoding", "UTF-8"))
+			msg=unicode(msg, fallback).encode(self.getConfig("encoding", "UTF-8", "main"))
 		except UnicodeEncodeError:
 			pass
 			#self.logger.debug("Unicode Encode Error with String:"+str(msg))
@@ -303,7 +304,7 @@
 		
 	def sendme(self, channel, action, encoding="iso-8859-15"):
 		"""msg function, that converts from iso-8859-15 to a encoding given in the config"""
-		action=unicode(action, encoding).encode(self.getConfig("encoding", "UTF-8"))
+		action=unicode(action, encoding).encode(self.getConfig("encoding", "UTF-8", "main"))
 			
 		self.me(channel, action)
 		self.action(self.nickname, channel, action)




Mehr Informationen über die Mailingliste Otfbot-dev