[z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n

Maciej Wiśniowski maciej.wisniowski at coig.katowice.pl
Mon Jul 24 09:28:52 CEST 2006


>>Is this possible to see that code? I'm very interested in it :)
>>    
>>
>
>I know people sometimes do it, but it makes code unportable and could
>cause other subtle problems.
>  
>
I've already found some examples of sitecustomize.py that
change defaultencoding.
We're using windows and linux so it may be unportable, but
I think it may be still helpful in some cases.

Maybe it should be a option in zope.conf that will allow to
change this behaviour. Firstly I though that
'zpublisher-default-encoding' or 'locale' will do the thing...
but, as you know, it doesn't.

>Unicode is more fun also.
>  
>
But is more difficult especially for begineers and
especially in Zope2. It's a bit strange to write
strings with u'. I've never seen this in other languages.

So far it seems that we have to use functions like
yours:

def u(s, encoding="utf-8"):
    """Convert from UTF8 to Unicode (if needed)"""
    ...


for data stored in attributes and for data
retrieved from database and be careful to use
u'...' strings instead of '...'.

Any other clues for Five programmers? :)

-- 
Maciej Wisniowski


More information about the z3-five mailing list