saving octet-stream png file

Larry Martell larry.martell at gmail.com
Mon Aug 22 10:37:57 EDT 2016


On Sun, Aug 21, 2016 at 5:24 PM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
> On 2016-08-19, Larry Martell <larry.martell at gmail.com> wrote:
>> fd.write(request.POST[key])
>
> You could try:
>
>   request.encoding = "iso-8859-1"
>   fd.write(request.POST[key].encode("iso-8859-1"))
>
> It's hacky and nasty and there might be a better "official" method
> but I think it should work.

For some reason that messes up the request structure:

(Pdb) type(request.POST[key])
<type 'unicode'>
(Pdb) request.encoding = "iso-8859-1"
(Pdb) type(request.POST[key])
*** MultiValueDictKeyError:
"u'right-carotidartery:63B2E474-D690-445F-B92A-31EBADDC9D93.png'"



More information about the Python-list mailing list