[Zope] Searching Catalog for Unicode Values of FieldIndex

Dieter Maurer dieter at handshake.de
Sun Aug 15 16:35:00 EDT 2004


Mohsen Moeeni wrote at 2004-8-14 14:19 +0430:
>I am disappointed to find out that FieldIndex does not support Unicode values.

A FieldIndex does support Unicode values.
However, *all* indexed values must then be either pure ASCII or unicode!

>While searching a catalog for a FieldIndex which has a value out of ASCII range,
>one would encounter the following error:
>
>'ascii' codec can't decode byte 0xd9 in position 0: ordinal not in range(128)

Look at the traceback. Always do this when you get errors!

Almost surely, your index contains a non ASCII and non unicode value.
When the index lookup compares the keys, the non ASCII value
is converted into unicode (as there is another unicode operand)
and this fails.

You can use a "Managable FieldIndex". It allows you to convert
all values to unicode with your chosen encoding (specifying the
encoding could be easier -- maybe in the next release).

  <http://www.dieter.handshake.de/pyprojects/zope>


-- 
Dieter


More information about the Zope mailing list