From fcd7fddbdd37e24b5817ba51109f576b972388cb Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 20 Jul 2012 01:19:12 -0400 Subject: [PATCH] MD5 can't handle Unicode, so fully implement saving Unicode objects by fixing that. --- earwigbot/wiki/page.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/earwigbot/wiki/page.py b/earwigbot/wiki/page.py index 0852657..17274bc 100644 --- a/earwigbot/wiki/page.py +++ b/earwigbot/wiki/page.py @@ -345,7 +345,8 @@ class Page(CopyvioMixIn): def _build_edit_params(self, text, summary, minor, bot, force, section, captcha_id, captcha_word): """Given some keyword arguments, build an API edit query string.""" - hashed = md5(text).hexdigest() # Checksum to ensure text is correct + unitxt = text.encode("utf8") if isinstance(text, unicode) else text + hashed = md5(unitxt).hexdigest() # Checksum to ensure text is correct params = {"action": "edit", "title": self._title, "text": text, "token": self._token, "summary": summary, "md5": hashed}