From af8cb99f312f1ae397747c9cf62af46fdb59c5f8 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Tue, 11 Mar 2014 11:48:19 -0400 Subject: [PATCH] Handle non-ascii IRC messages --- chanlogs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chanlogs.py b/chanlogs.py index f1d652e611..d23d9f4d45 100644 --- a/chanlogs.py +++ b/chanlogs.py @@ -62,7 +62,7 @@ def _format_template(tpl, bot, **kwargs): origin=bot.origin, datetime=dt.isoformat(), date=dt.date().isoformat(), time=dt.time().isoformat(), **kwargs - ) + ) + "\n" def setup(bot): @@ -101,7 +101,7 @@ def log_message(bot, message): fpath = get_fpath(bot) with bot.memory['chanlog_locks'][fpath]: with open(fpath, "a") as f: - f.write(logline + "\n") + f.write(logline.encode('utf-8')) @willie.module.rule('.*') @@ -113,7 +113,7 @@ def log_join(bot, trigger): fpath = get_fpath(bot, channel=trigger) with bot.memory['chanlog_locks'][fpath]: with open(fpath, "a") as f: - f.write(logline + "\n") + f.write(logline.encode('utf-8')) @willie.module.rule('.*') @@ -125,7 +125,7 @@ def log_part(bot, trigger): fpath = get_fpath(bot, channel=trigger) with bot.memory['chanlog_locks'][fpath]: with open(fpath, "a") as f: - f.write(logline + "\n") + f.write(logline.encode('utf-8')) @willie.module.rule('.*') @@ -142,7 +142,7 @@ def log_quit(bot, trigger): fpath = get_fpath(bot, channel) with bot.memory['chanlog_locks'][fpath]: with open(fpath, "a") as f: - f.write(logline + "\n") + f.write(logline.encode('utf-8')) @willie.module.rule('.*') @@ -159,4 +159,4 @@ def log_nick_change(bot, trigger): fpath = get_fpath(bot, channel) with bot.memory['chanlog_locks'][fpath]: with open(fpath, "a") as f: - f.write(logline + "\n") + f.write(logline.encode('utf-8'))