[Zope-dev] [ZPublisher] specifiying 'charset' for the
content-type header
Andreas Jung
lists at andreas-jung.com
Sun Dec 25 12:54:32 EST 2005
--On 23. Dezember 2005 19:28:52 +0000 Chris Withers
<chris at simplistix.co.uk> wrote:
>>
>> The HTTP spec says that a http server *can* set the charset to make the
>> encoding of the payload clear. That's what we are doing now. Not
>> specifying the charset means for the browser: *guessing* the encoding
>> which means the browser defaults to some unspecified default encoding.
>
> Yes, but we're essentially guessing too, right? :-S
>
>
No. Imagine a PythonScript that returns a unicode string. The ZPublisher
converts the unicode string to latin1 (zpublisher_default_encoding). Most
browsers will default Latin1 when they can't find the charset in the
content-type header. When you configure the ZPublisher to convert output to
utf-8 then browsers will still default to Latin1 although the output it
utf-8. So we tell the browser which encoding the ZPubisher was using to
produce the output.
-aj
-------------- 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/20051225/ea450ec9/attachment.bin
More information about the Zope-Dev
mailing list