Author quentel
Recipients amaury.forgeotdarc, barry, eric.araujo, erob, flox, ggenellina, oopos, pebbe, pitrou, quentel, r.david.murray, tcourbon, tercero12, tobias, v+python, vstinner
Date 2011-01-10.21:55:55
SpamBayes Score 2.00138e-09
Marked as misclassified No
Message-id <1294696567.45.0.198907232103.issue4953@psf.upfronthosting.co.za>
In-reply-to
Content
@Glenn
" The _defined_ encoding of the original stream is irrelevant, in the same manner that if it is a text stream, that is irrelevant.  The stream is binary, and latin-1, or it is non-standard"

I wish it could be as simple, but I'm afraid it's not. On my PC, sys.stdin.encoding is cp-1252. I tested a multipart/form-data with an INPUT field, and I entered the euro character, which is encoded  \x80 in cp-1252

If I use the encoding defined for sys.stdin (cp-1252) to decode the bytes received on sys.stdin.buffer, I get the correct value in the cgi script ; if I set the encoding to latin-1 in FieldStorage, since \x80 maps to undefined in latin-1, I get a UnicodeEncodeError if I try to print the value ("character maps to <undefined>")
History
Date User Action Args
2011-01-10 21:56:07quentelsetrecipients: + quentel, barry, amaury.forgeotdarc, ggenellina, pitrou, vstinner, eric.araujo, v+python, r.david.murray, oopos, tercero12, tcourbon, tobias, flox, pebbe, erob
2011-01-10 21:56:07quentelsetmessageid: <1294696567.45.0.198907232103.issue4953@psf.upfronthosting.co.za>
2011-01-10 21:55:55quentellinkissue4953 messages
2011-01-10 21:55:55quentelcreate