jdriscoll/django-imagekit — Issue #86: issue in _default_cache_to using unicode filenames
Author: holg
Created: 2012-01-26 22:53:43+00:00
State: open

whenever it try to process via _default_cache_to a filename containing unicode characters (e.g. 'grün'), there will be an

_default_cache_to
instance, path, specname, extension)
266 filepath, basename = os.path.split(path)
267 filename = os.path.splitext(basename)[0]
--> 268 new_name = u'%' %'{0}_{1}{2}'.format(filename, specname, extension)
269 return os.path.join(os.path.join('cache', filepath), new_name)
270

UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 8: ordinal not in range(128)

i could easily fix that by making the format string completely unicode like this:
Line 268 (imagekit 1.11):
changed from currently:

new_name = '{0}_{1}{2}'.format(filename, specname, extension)

to

new_name = u'{0}_{1}{2}'.format(u'%s' %filename, u'%s' %specname, u'%s' %extension)