[Zope-dev] Should PageTemplate._text be a unicode or an encoded string in Zope 2.9.3?

Tino Wildenhain tino at wildenhain.de
Sat Jul 22 10:17:09 EDT 2006


Andreas Jung schrieb:

>
>
> --On 22. Juli 2006 15:34:01 +0200 Tino Wildenhain <tino at wildenhain.de> 
> wrote:
>
>> Well, pagetemplate files are another thing. They have to deal with
>> the lack of charset information of a filesystem file and what they
>> do once they load the data is even another thing.
>>
>> Even filesystem pagetemplates should work with unicode internal,
>> making it easy to recode them for output and combine with other
>> potentially unicode stuff.
>
>
>
> huh?..even on the file system a pt file is encoded using some encoding.
> For an XML pagetemplate file the encoding is clearly defined through 
> the BOM (if available) and/or the XML preamble. So the most reliable 
> solution would be to use XML PTs only.

Yes but you have to explicitely store that information "somehow" in the
file - zope objects can use other methods to transfer encoding information
while they create the internal representation.
meta-tags for charset are quite ugly but you basically have no other
choice with filesystem stuff.
Problem here if the various encoding notifications collide (XML header 
vs. XHTML meta-tag vs. BOM) so better have as few as possible - even 
better none when
we deal with HTTP-Servers which can nicely handle this all out of band
and on demand.

webdav or put can send charset data, zmi would use 
default-zpublisher-encoding
etc. If you store the internal object in unicode you can safely combine
different souces of encoded data instead of having a weird mesh of
decoding and encoding going on.

So I would not care how to find out about the intended encoding - once the
object is instantiated.

Regards
Tino


More information about the Zope-Dev mailing list