durusmail: quixote-users: Patch[2] for http_response.py for quixote-2.1 (_encode_chunk)
Patch[2] for http_response.py for quixote-2.1 (_encode_chunk)
2005-08-21
2005-08-29
Patch[2] for http_response.py for quixote-2.1 (_encode_chunk)
Hamish Lawson
2005-08-29
I'd like to add my support for Damjan's patch:

"This patch for Quixote-2.1/http_response.py changes the
HTTPResponse._encode_chunk method to only call the .encode method on
unciode objects, otherwise assume the programer knows what he does and
just send the byte string as is."

Quixote has no way of knowing how a str object has been encoded. When
the response's character set is set to iso-8959-1, Quixote can't know
whether the returned string has actually been encoded accordingly; and
for any other character set, Quixote can't know whether a returned str
object has in fact been encoded in ASCII (at best it can only
determine whether its bytes fall in the range 0x00 to 0x7F). It
therefore doesn't make sense to let a str object pass as is only when
the character set for the response is set to iso-8959-1.


Hamish Lawson
reply