I have some python code (part of a django app) that processes a
request that contains a png file. The request is send with
content_type = 'application/octet-stream'
In the python code I want to write this data to a file and still have
it still be a valid png file.
The data I get looks like this:
u'\ufffdPNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01\ufffd\x00\x00\x01\ufffd
......'
If I try and write that to a file it fails with a UnicodeEncodeError.
If I write it with encode('utf8') it writes the file, but then it's no
longer a valid png file.
Anyone know how I can do this?
--
https://mail.python.org/mailman/listinfo/python-list