[Zope-CMF] [CMF 2.1] FSPageTemplate & Unicode

Andreas Jung lists at andreas-jung.com
Wed Dec 20 13:34:22 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



- --On 19. Dezember 2006 09:58:37 +0100 Jens Vagelpohl <jens at dataflake.org> 
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> On 19 Dec 2006, at 09:45, Andreas Jung wrote:
>> Jup. However I am not completely sure about all impacts :-)
>
> If I understand the description correctly, the real change is in how the
> "surrogate" page template object representing the filesystem page
> template is created. The rendering itself is handed off to the pt_render
> method from the original PageTemplate class.

Right. The pt_render() should return unicode only. Let's assume 
FSPageTemplates would use unicode internally and a customized copy (an 
instance of ZopePageTemplate) wouldn't then we would definitely run
into UnicodeDecode errors. That's why we should use unicode as internal
representation where possibly. However applications will likely run into
UnicodeDecode error for example with scripts returning non-unicode...

>
> If you look at the current FSPageTemplate code, there was already an
> attempt to find and transfer enoding information with the response by way
> of adding it to the content type, see _readFile. It does preamble
> sniffing as well. That could then be replaced by your own encoding
> detection, which also uses the preamble, and .metadata information.
>

I created an experimental branch and added some more (hopefully)
clever sniffing (which I added recently for the ZPT fixes on the HEAD).

Andreas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFiYIvCJIWIbr9KYwRAoOGAJ4iOqjJkJokXW5W5O1bJJTDCeGkWwCgoBWQ
bgkZc8ETfb+49kepMJ1DNuc=
=ZWTb
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list