hovel / imagestore

Django gallery solution.
BSD 3-Clause "New" or "Revised" License
164 stars 71 forks source link

zip upload: encode any string to ascii that could contain non-ascii, before print #30

Closed topiaruss closed 10 years ago

topiaruss commented 10 years ago

The Linux terminal is by default an ascii device. So printing unicode raises a unicode exception. The flow of the code here is fine -- except for the print.

So I've left the print in place (it would be better to use python logging, but I'm not going to get religious), and added the essential encode. The errors='replace' kwarg is needed to ensure that 'something' is printed instead of non-printable characters. By default this is a normal ascii '?'.