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

Chris Withers chris at simplistix.co.uk
Mon Jul 24 14:15:27 CEST 2006


Roman Susi wrote:
> Maciej Wisniowski wrote:
>>> Well, I actually buckled and put a sitecustomize.py on the python path 
>>> that chanded the default codec from ascii to utf-8.
>>>
>> Is this possible to see that code? I'm very interested in it :)
> 
> I know people sometimes do it, but it makes code unportable 

How so? None of the code that could usefully be ported from this project 
relies on this fact (it all just runs off unicode), but the project 
specific code does, and I think that's a safe assumption to make, given 
what I've already stated...

> and could
> cause other subtle problems.

Such as? (or is this just goat/chicken worship?)

>> And in general why is unicode object better than
>> utf-8 encoded string?
> 
> Unicode object is more preferable because it is easier to process (that
> is, you you do not just store text but apply regular expressions,
> searches, calculate lengths, etc.). Of course, usual 1-byte encoding is
> even more simpler to use but it is not suitable on international scale.
> 
> So, utf-8 encoded strings are convenient only as Unicode serialization:
>  when sending Unicode over network, when storing in byte-oriented layers
> (like Unicode-unaware database or XML file).

...or more simply put, you don't get Unicode errors if everything is 
Unicode, and that's a pretty big win for me ;-)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the z3-five mailing list