[Zope] unicode error
ChristopherN.Deckard
ChristopherN.Deckard
Tue, 27 Aug 2002 07:31:23 -0500
On Tue, 27 Aug 2002 13:23:28 +0100, Toby Dickenson
<tdickenson@geminidataloggers.com> spoke forth:
> 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).
Does case sensitivity make a difference? I did "ISO-8859-1",
following an email in one of the list archives. Still had the same
problem.
> 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 = XMLstring + new_part_from_folder_property
>
> I guess that XMLString is a unicode object, and
> new_part_from_folder_property is a plain string that contains
> characters outside the ASCII range.
Actually, XMLstring is a str, and the new_part_from_folder_property
is some weird string. I don't know the encoding type. I'm not I
know how to find it either...
> What character encoding have you used for those properties? You
> need to use code like:
>
> XMLstring = XMLstring +
> unicode(new_part_from_folder_property,'UTF-8')
>
> subsitute your real encoding for utf-8
Real encoding being the encoding type of the string right?
> A better solution might be to store new_part_from_folder_property
> as a unicode object.
I have no control of that. It is a string from a zope property.
-Chris