This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author orsenthil
Recipients bero, eric.araujo, ezio.melotti, orsenthil, santoso.wijaya, terry.reedy
Date 2011-05-06.13:08:18
SpamBayes Score 1.982473e-09
Marked as misclassified No
Message-id <1304687300.2.0.796650121298.issue11898@psf.upfronthosting.co.za>
In-reply-to
Content
Hello Bernhard, 

I tried to a POST of JPEG file, through urllib2 (which internally uses httplib) and goes through the code that you pointed out and I don't face any problem. I am able to POST binaries using httplib.

I am also surprised at UnicodeDecodeError which is being raised. The POST data is string (8-bit strings) in Python2.7 and the portion of code will have no problem in creating the content.

You will get UnicodeDecodeError, only if you explicitly pass a Unicode Object as Data and never when you pass string or binary string.

Perhaps mechanize is doing something wrong here and sending a Unicode object.

So, this really does not look like a bug to me.

(Also a note on patch. The patch tries to silence the error, which is wrong thing to do).

If you can provide a simple snippet to reproduce this error, feel free reopen this again. I am closing this as 'works for me'.

Thanks.
History
Date User Action Args
2011-05-06 13:08:20orsenthilsetrecipients: + orsenthil, terry.reedy, bero, ezio.melotti, eric.araujo, santoso.wijaya
2011-05-06 13:08:20orsenthilsetmessageid: <1304687300.2.0.796650121298.issue11898@psf.upfronthosting.co.za>
2011-05-06 13:08:19orsenthillinkissue11898 messages
2011-05-06 13:08:18orsenthilcreate