Fixing an issue when for files which contain unicode data
The django.core.files.base module uses the cStringIO package where available. However, unlike StringIO, cStringIO does not support unicode data, and the result is additional null bytes being entered into the output file. The trick seems to be to convert the data into a byte string before passing it into ContentFile, which I do here using Django's smart_str() utility. Signed-off-by: Timothée Peignier <timothee.peignier@tryphon.org>
Showing
Please
register
or
sign in
to comment