Pierre Quentel <[email protected]> added the comment:
@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>")
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue4953>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com