[ZPT] Makeing PageTemplate's edit pages Unicode aware
Dieter Maurer
dieter at handshake.de
Mon Mar 29 16:12:45 EST 2004
Stuart Bishop wrote at 2004-3-29 18:13 +1000:
> ...
>Currently, if you create a page template that contains non-ASCII
>characters, any tal:content or tal:replace expressions that return
>Unicode will now raise a Unicode error. This can be demonstrated
>simply:
> <html>
> <div>My 2¢</div>
> <div tal:content="python:u'My 2\N{CENT SIGN}'">My 2¢</div>
> </html>
Yes, but when you convert the PageTemplate automatically to Unicode,
any non-unicode value (e.g. from a Python Script) will raise
a similar exception when it contains non-ASCII characters
(more precisely: characters not covered by Python's default encoding).
Thus, conversion to Unicode needs to be controllable by some site
property.
>These are the things I think need to be fixed in Zope's Page Templates
>implementation to make them Unicode aware. There may be more (?):
>
> - It should be possible for the actual page template source to
> be stored as a Unicode string. Currently, there is an assert
> ensuring it is a traditional string.
Do I believe this?
I have strong hints that at least XML PageTemplates (to be precise
"FSPageTemplate") are in fact stored as Unicode.
> ...
> - PageTemplate.write(text) should raise an exception if text
> is not either a Unicode string or an ASCII string.
I disagree here:
Many environments need to handle non-ASCII characters but do not
need the complexity of Unicode.
> ...
> - The file upload widget needs to either be removed, or grow
> a charset box. I don't think either of these solutions are
> ideal :-(
Again: you do not need to worry in many environments...
--
Dieter
More information about the ZPT
mailing list