[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
Tue Jul 25 11:26:02 CEST 2006
>It's pretty easy, I think. Most people just don't explain it well enough.
>
>
You're right, when starting with python it is rather difficult to find
out what and why
this unicode is. I understand it, but thanks for this nice explatation,
it will be helpful :)
>>and especially in Zope2. It's a bit strange to write strings with u'.
>>I've never seen this in other languages.
>>
>>
>
>And I've never seen meaningful indention in other languages. What's your
>point? You want to reject unicode because you don't like its syntax???
>
>
No! I'm not rejecting unicode. I simply don't like writing
u'...' :) I think it may be error prone and difficult for
newcomers to track down unicode decode errors that
appear because of forgetting about this.
But I understand why u'syntax is used now.
As Roman Susi said in other topic, in Python3000 everything
will be unicode, so I understand we'll have not to
use u'syntax, do we?
When I'm reading posts from me, Chris Withers, Roman Susi
and others I can say that unicode in Five isn't so easy in practice,
especially without good documentation, and clear rules such:
"Anything that contains human text should be unicode" :)
>Huh? Simply do some_unicode_string.encode('utf-8'). But, again, unless
>you're actually writing stuff to the filesystem, I doubt you should ever
>have to manually encode or decode stuff, even in Zope 2 (provided you
>use certain helpers from Five).
>
>
Yes you should'n have to encode or decode but, as you said before, only
if you
don't have to deal with legacy stuff, things that are setup via ZMI
(like attributes of folders etc.), database adapters that don't use
unicode etc.
I have all such things right now so the method from
Roman Susi that try: excepts: is nice for me.
I definitely agree we should move everything to unicode,
but it's not so easy.
If somebody has to write something new and knows the
rules then he'll possibly have no such problems...
until he forgets about u'...' somewhere ;)
--
Maciej Wisniowski
More information about the z3-five
mailing list