[Zope] unicode error

Toby Dickenson tdickenson@geminidataloggers.com
Tue, 27 Aug 2002 13:23:28 +0100


On Tuesday 27 Aug 2002 12:44 pm, Andreas Jung wrote:
> You might try to set the default characterset encoding
> of your Python interpreter to "iso-8859-1". Python
> defaults to ascii (check your site.py file of your
> Python installation).

Yes, but that may not be supported in future

http://mail.python.org/pipermail/i18n-sig/2000-July/000344.html

> > Error Type: UnicodeError
> > Error Value: ASCII decoding error: ordinal not in range(128)
> >
> > There are non-ascii characters stored in properties of folders and
> > I'm trying to build an xml string to send off to a ParsedXML object
> > for parsing.  Do I need to encode with a different encoding?  I'm
> > basically doing:
> >
> >    XMLstring =3D XMLstring + new_part_from_folder_property

I guess that XMLString is a unicode object, and new_part_from_folder_prop=
erty=20
is a plain string that contains characters outside the ASCII range.

What character encoding have you used for those properties? You need to u=
se=20
code like:

XMLstring =3D XMLstring + unicode(new_part_from_folder_property,'UTF-8')

subsitute your real encoding for utf-8


A better solution might be to store new_part_from_folder_property as a un=
icode=20
object.