Manfred Stienstra
manfred.stienstra at dwerg.net
Wed Nov 26 22:19:08 EST 2003
On Wed, 2003-11-26 at 21:55, Gregory (Grisha) Trubetskoy wrote: > So there is no problem with mod_python? Setting content_type to a unicode string should not be possible. I don't know how the other headers are implemented, but some of them are allowed to contain strings other than us-ascii (but never above 8 bits). The constraint in HTTP is that headers should never contain multibyte characters (or should never have to be interpreted as being a multibyte character), the strings have to contain 8 bit characters. The problem with python is that a unicode object can contain characters coming from any encoding, and can be converted to any other encoding. This means that a unicode object with data coming from us-ascii could be used in headers by silently encoding them to us-ascii, but this is not recommended because it would cause a lot of confusion. Programmers should encode unicode objects to us-ascii strings before using them as header values. In short: there is no problem. Manfred
|