From: Vincent Le Gallic Date: Fri, 11 May 2012 17:25:40 +0000 (+0200) Subject: Des problèmes d'utf8 quand il apprend à compter X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fbasile.git;a=commitdiff_plain;h=b6490211b2cc2fa805c985ba2460fe773fd511b6 Des problèmes d'utf8 quand il apprend à compter --- diff --git a/basile.py b/basile.py index 4d330f3..6314b9c 100755 --- a/basile.py +++ b/basile.py @@ -776,7 +776,7 @@ class Basile(ircbot.SingleServerIRCBot): answer=random.choice(config_merci_answers) for ligne in answer.split("\n"): serv.privmsg(canal,"%s: %s"%(auteur,ligne.encode("utf8"))) - out=re.match(u"^([A-Z[]|\\|[0-9]+|(¹|²|³|⁴|⁵|⁶|⁷|⁸|⁹|⁰)+)(?:| \?| !)$", + out=re.match(ur"^([A-Z[]|\\|[0-9]+|(¹|²|³|⁴|⁵|⁶|⁷|⁸|⁹|⁰)+)(?:| \?| !)$", unicode(message.upper(),"utf8")) if out and not canal in self.quiet_channels: out=out.groups()[0] @@ -797,7 +797,7 @@ class Basile(ircbot.SingleServerIRCBot): serv.privmsg(canal,"%s: pfff, j'ai l'air malin maintenant… [ ?"%(auteur)) elif out in "[\\": serv.privmsg(canal,"%s: nan mais il faut qu'on arrête, ça va finir par poser des problèmes…"%(auteur)) - elif re.match(r"(¹|²|³|⁴|⁵|⁶|⁷|⁸|⁹|⁰)+",out): + elif re.match(ur"(¹|²|³|⁴|⁵|⁶|⁷|⁸|⁹|⁰)+",out): def translate(mess): return "".join([{u"⁰¹²³⁴⁵⁶⁷⁸⁹0123456789"[i]:u"0123456789⁰¹²³⁴⁵⁶⁷⁸⁹"[i] for i in range(20)}[j]