[Zope-dev] [ZPublisher] specifiying 'charset' for the content-type
header
Chris Withers
chris at simplistix.co.uk
Wed Dec 21 13:07:49 EST 2005
Andreas Jung wrote:
> The following usecase is not handled correctly by Zope:
>
> When you call a PythonScript returning a Python unicode string then
> the ZPublisher/HTTPResponse code will convert the unicode response
> string using HTTPResponse.default_encoding to a Python string. The
> default encoding
> is configurable through zope.conf (zpublisher_default_encoding key).
> This works fine unless you change the encoding to utf-8. In this case
> Zope sends out UTF8 content without specifying the encoding in the
> content-type header.
>
> I propose the following changes:
>
> - Zope adds content-type: text/plain|html when no content-type
> is specified by the application. In this case we would add
> 'charset=<DEFAULT_ENCODING>
>
> - if the application specfies a content-type header then we would add the
> charset only if it is undefined
>
> Objections?
This sounds worryingly DWIM-y :-S
How will Zope know when _not_ to add the content-type header?
How will Zope tell if the charset is "undefined" and what does
"undefined" mean in this context?
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-Dev
mailing list