From adc785ade40dcf87743c853025881b740e64fe98 Mon Sep 17 00:00:00 2001 From: Amr Hassan Date: Mon, 29 Jun 2009 09:01:00 +0000 Subject: [PATCH] fixed some unicode problems with hashlib, i hope. --- pylast.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pylast.py b/pylast.py index 9f6d77e..842d7dd 100644 --- a/pylast.py +++ b/pylast.py @@ -193,7 +193,7 @@ class _Request(object): for key in keys: if key != "api_sig" and key != "api_key" and key != "sk": - cache_key += urllib.quote_plus(key) + urllib.quote_plus(urllib.quote_plus(self.params[key])) + cache_key += key + self.params[key].encode("utf-8") return hashlib.sha1(cache_key).hexdigest() @@ -219,7 +219,7 @@ class _Request(object): data = [] for name in self.params.keys(): - data.append('='.join((name, urllib.quote_plus(self.params[name])))) + data.append('='.join((name, urllib.quote_plus(self.params[name].encode("utf-8"))))) data = '&'.join(data) headers = { @@ -2790,7 +2790,7 @@ def md5(text): """Returns the md5 hash of a string.""" hash = hashlib.md5() - hash.update(text) + hash.update(text.encode("utf-8")) return hash.hexdigest()