fix encoding issue

This commit is contained in:
Yann Leboulanger 2013-01-05 23:06:59 +01:00
parent 23fe7d6c56
commit 94168c01ae
1 changed files with 2 additions and 2 deletions

View File

@ -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')