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

2006-07-22 Thread Stefan H. Holek
zope.pagetemplate.pagetemplatefile.PageTemplateFile reads an eventual  
meta http-equiv=Content-Type ... header, or defaults to UTF-8.


Stefan


On 21. Jul 2006, at 16:53, Chris Withers wrote:


I wonder how Zope 3's filesystem-based ZPT's deal with this?


--
Anything that, in happening, causes something else to happen,
causes something else to happen.  --Douglas Adams


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


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

2006-07-22 Thread Tino Wildenhain
Stefan H. Holek wrote:

 On 21. Jul 2006, at 16:53, Chris Withers wrote:
 
 I wonder how Zope 3's filesystem-based ZPT's deal with this?
 

 zope.pagetemplate.pagetemplatefile.PageTemplateFile reads an eventual
 meta http-equiv=Content-Type ... header, or defaults to UTF-8.

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.

Tino
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2006-07-22 Thread Andreas Jung



--On 22. Juli 2006 15:34:01 +0200 Tino Wildenhain [EMAIL PROTECTED] 
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.


-aj

pgpk47LXu3Abb.pgp
Description: PGP signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2006-07-22 Thread Tino Wildenhain

Andreas Jung schrieb:




--On 22. Juli 2006 15:34:01 +0200 Tino Wildenhain [EMAIL PROTECTED] 
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
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


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

2006-07-22 Thread Andreas Jung



--On 22. Juli 2006 16:17:09 +0200 Tino Wildenhain [EMAIL PROTECTED] 
wrote:

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


I am only talking of XML. And the encoding is clearly and unambiguously 
defined through the BOM (if available) and the XML preamble. So any 
application reading an XML file is able to detect the encoding and produce
a unicode string from the file. According to a discussion with Dieter the 
Python XML parsers don't deal with the BOM and leave it up to the 
application to interpret the BOM correctly.


-aj 

pgpHsujepZPLt.pgp
Description: PGP signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2006-07-22 Thread Tino Wildenhain
Andreas Jung wrote:
 
 
 --On 22. Juli 2006 16:17:09 +0200 Tino Wildenhain [EMAIL PROTECTED]
 wrote:
 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
 
 I am only talking of XML. And the encoding is clearly and unambiguously
 defined through the BOM (if available) and the XML preamble. So any

Pardon, thats nonsense. BOM means byte oder mark and not encoding mark
(It would read EM instead, wouldnt it? ;) Its only used with some 16 bit
encodings to tell the byte order of the two bytes (obviously).
And XML only via its XML preambel, which is just another place to put
encoding information in band. (In fact we should have publishing engine
to fix this preamble as well as the infamous meta-tag (if available)
to reflect the encoding currently in use.


 application reading an XML file is able to detect the encoding and produce
 a unicode string from the file. According to a discussion with Dieter

Yes, and in case of the filesystempagetemplates and friends, the
template is that application which reads and should produce the unicode
string.


Regards
Tino
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )