From 94168c01ae4ed13dfa9e93a92734facf5c0077fb Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 5 Jan 2013 23:06:59 +0100 Subject: [PATCH] fix encoding issue --- src/common/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/helpers.py b/src/common/helpers.py index 775401367..733a43232 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -552,8 +552,8 @@ def sanitize_filename(filename): """ # 48 is the limit if len(filename) > 48: - hash = hashlib.md5(filename) - filename = base64.b64encode(hash.digest()) + hash = hashlib.md5(filename.encode('utf-8')) + filename = base64.b64encode(hash.digest()).decode('utf-8') # make it latin chars only filename = punycode_encode(filename).decode('utf-8')