unicode decoding issue

Andy <[email protected]>
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Hi Developers,

I can't recall whether Silva and related packages are python2.3 supported yet, 
but here's and issue I've had to deal with somewhere (can't recall exactly) 
in the Silva code, and well as in Formulator.Valitade.StringValidtor.validate

This function checks to see if the value is supposed to be unicode, and 
blindlly converts it to unicode.  Apparrently in python2.3 doing this:
>>> unicode(u'','utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: decoding Unicode is not supported
>>>

The easy way to fix (for this formulator problem) is this:
if field.get_value('unicode') and not isinstance(value,UnicodeType):
   # use acquisition to get encoding of form
   value = unicode(value, field.get_form_encoding())

Would you like me to create submit an incident to the bugtracker for this?

Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.