[Zope] How to convert Zope instance charset?

Andreas Jung lists at andreas-jung.com
Sun Apr 24 23:34:04 EDT 2005


One last note from myside. I have experiences with unicode since over 7 
years while
working with multilingual documents in the e-publishing business. It is 
good practice
to perform *any* unicode related work *only* on unicode datatypes (Python 
unicode strings!!!)
and *not* some byte-encoded unicode strings as utf8 or whatever. These 
encodings
should only be used on the output level when presenting unicode data to the 
user - either
through-the-web,  as export format etc. This is a strong advice you should 
follow.

-aj

--On Sonntag, 24. April 2005 21:31 Uhr +0200 Daniel Dekany 
<ddekany at freemail.hu> wrote:

> 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



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050425/e5b258d0/attachment.bin


More information about the Zope mailing list