[Zope-dev] [ZPublisher] specifiying 'charset' for the content-type header

Andreas Jung lists at andreas-jung.com
Mon Dec 19 07:56:28 EST 2005


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?

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20051219/27a7d1d4/attachment-0001.bin


More information about the Zope-Dev mailing list