Support for Django 1.4 with python 2.5, copied from
https://github.com/jhmaddox/django-precompressed/issues/1
("AttributeError: StringIO instance has no attribute 'name'")
Applied cleaned up fixes from Anders.Du (duyu)
Added subject decode