It should also be noted that it is a terrible user experience to raise
an exception in the middle of parsing the multipart parser---a socket
error with no error message. Not to say that you can't slurp in the
data and raise the exception afterwards, but care has to be given if
that strategy is taken.

-Mike

On Thu, Mar 29, 2012 at 2:31 PM, Alex Ogier <alex.og...@gmail.com> wrote:
> On Mar 29, 2012 5:43 AM, "Tai Lee" <real.hu...@mrmachine.net> wrote:
>>
>> I've just created an essay *cough* I mean ticket about the way Django 
>> silently mangles POST data that is incorrectly encoded, and how this can 
>> send someone (like me) down the rabbit hole trying to debug it, thanks to 
>> "current transaction aborted" database errors.
>>
>
> This reminds me of Postel's Law, "Be conservative in what you do, be
> liberal in what you accept from others." I see the reason behind your
> desire to respond to this unicode error at the point of encoding, but
> the issue is that there is no reasonable way for anyone to handle the
> error condition. I mean, do you spit back a validation error, "Your
> browser encoded the image filename in an inconsistent way. Go jump in
> a ditch"? If the browser gave you a filename in a wonky encoding, a
> best-effort approximation of the intended filename is the best anyone
> can unless you want to send a reminder to upgrade to the latest Chrome
> ve.
>
> So the real bug here is not, "Why can't I catch and fix Unicode
> problems when decoding the filename?" because you almost certainly
> don't want to do that. The question is why force_encoding(...,
> errors='replace') is giving you a string that PostgreSQL can't handle.
>
> Best,
> Alex Ogier
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to