[Zope-dev] [Zope 2.10] ZPT going Unicode

Martijn Faassen faassen at infrae.com
Fri Jan 13 07:28:34 EST 2006


Andreas Jung wrote:
> 
> 
> --On 5. Januar 2006 12:47:20 +0100 Andreas Jung <lists at andreas-jung.com> 
> wrote:
> 
>> As you might know I worked on the integration of the Zope 3 ZPT
>> implementation for Zope 2.10. Before commiting the changes to the trunk I
>> would like discuss my approach for Zope 2.10
> 
> 
> I forgot to mention a major point: compatibility.
> 
> When a ZPT is internally stored a unicode string then content returned 
> by methods called through the ZPT will be implicitly  converted to unicode.
> This will definitely raise UnicodeDecodeErrors. So how to deal with this 
> issue?

Ah, I wrote my reply before reading this.

> - allowing only unicode textual content when calling macros, PyScript etc.
> 
> - converting non-unicode to unicode inside the TAL code using some
>   encoding. The encoding could be specified as property of the called
>   method (function properties) or object.

In effect Python already does this, it just decodes to unicode using a 
strict ASCII encoding. Making this configurable per page template might 
be good, though I'm worried about supporting implicit behavior leading 
to bad coding patterns. I'd prefer code to be Python unicode clean, but 
allowing in, say, UTF-8 strings, into a page template and then 
implicitly converting them to unicode, is inviting people to persist in 
not understanding the way to write good unicode code.

> We really _need_ to discuss this issue early to minimize side effects
> and to be able to provide the best compatibility possible.

Agreed!

Regards,

Martijn



More information about the Zope-Dev mailing list