[Zope] How to convert Zope instance charset?

Daniel Dekany ddekany at freemail.hu
Sun Apr 24 15:31:43 EDT 2005


Sunday, April 24, 2005, 7:22:42 PM, Andreas Jung wrote:

>
>
> --On Sonntag, 24. April 2005 18:34 Uhr +0200 Daniel Dekany 
> <ddekany at freemail.hu> wrote:
>
>>
>> Maybe *you* don't get the point. Python has a "virtual machine level"
>> setting that specifies the locale and encoding (the charset). You can
>> set it for example like: locale.setlocale('hu_HU', 'ISO-8859-2'). And
>> although there is no charset information attached to strings,
>> locale.strcoll and such will assume that the string is in the encoding
>> specified globally like above, right? All the strings (which is not an
>> unicode string) is assumed to use that encoding. It seems to me that it
>> works like that until I specify 'UTF-8' in the locale, in which case it
>> goes mad.
>
>
> I am very much aware of the issue (btw. it was me who integrated
> sequence.sort()).

You are aware of it, so why do you dispute if UTF-8 is supported (read:
can be used in practice)? Just how on the earth should anybody solve
this "on the application level"? Should everybody use only his own
products (that convert everything to "unicode" string)? Also everybody
should patch ZCatalog and similar core components which also sorts
non-unicode strings? Simply said, people can't use Zope with UTF-8 in
practice (while I guess they can with ISO-8859-x, right?), with my
original words "Since Python/Zope/etc practically doesn't support
utf-8". And I didn't meant to hurt or upbraid Zope fans with it at all,
I just said it as a fact in the middle of a sentence, and then what
happens...

(Why Plone guys use UTF-8 as default, I don't know, maybe they didn't
realized it doesn't work for people who really utilize utf-8. I'm for
too long in the business to be surprised. :) I think I will ask them...)

> And if you look carefully at the API of sequence.sort()
> then you will see that there is already built-in support locale-aware
> comparisons.

Yeah, I tried to use that earlier, but as I said for many times here, it
can't sort utf-8 encoded strings, despite that I have set the "global
locale" to something.utf8, certainly because Python locale.strcoll
can't. So at the end: You Can Not Use UTF-8 with Zope. Right? Soooo,
then back to the original question: converting and utf-8 instance to
ISO-8859-2 instance, any idea? (Or is it still the standpoint that I
should not??? D-%)

> -aj

-- 
Best regards,
 Daniel Dekany



More information about the Zope mailing list