[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.32

Martijn Faassen faassen at vet.uu.nl
Fri Aug 8 12:56:39 EDT 2003


Stephan Richter wrote:
> +        # We **always** have to convert unicode to ASCII. If no character set
> +        # is found, we just use unicode. That is still better than our server
> +        # crashing.
> +        if isinstance(text, unicode):
> +            return text.encode(self._charset or 'UTF-8')
>          return text

This comment is very misleading. We don't convert unicode to ASCII,
we convert unicode to a 8 bit string, in this case in UTF-8 encoding.
So yeah, we always have to convert unicode to an 8 bit string before
outputting it to the world. (does this set an encoding header for
the browser somewhere, by the way? It should..)

Regards,

Martijn




More information about the Zope3-Checkins mailing list