[Kolab-devel] Wallace error when processing iTips with UTF-8 characters

Sergio Talens-Oliag <[email protected]>
Newsgroups gmane.comp.kde.devel.kolab
Message-ID <[email protected]>
I was going to report a bug on https://issues.kolab.org/, but I don't really
know where to assign it, so I'm writting to the list first.

On my system when an iTip contains an UTF-8 character the processing fails
with the following error:

  pykolab.wallace ERROR event_from_ical() exception: UnicodeEncodeError('ascii', u'Ni\xf1o!!!', 2, 3, 'ordinal not in range(128)')

luckily that means that wallace assumes that the message is not an iTip and
the message is sent as a regular message that can be processed later as a manual invitation.

In any case, that is not what I want, of course.

For now I've been able to fix the problem changing the python default encoding
on the wallaced script:

  --- /usr/sbin/wallaced.orig
  +++ /usr/sbin/wallaced
  @@ -20,6 +20,11 @@
   
  import sys
	 
  +# BEG: Set default encoding to UTF-8 to be able to process iTip messages
  +reload(sys)
  +sys.setdefaultencoding('utf-8')
  +# END: Set default encoding to UTF-8 to be able to process iTip messages
  +
  # For development purposes
  sys.path.extend(['.', '..'])
	    
That works for me but it can have side effects and besides it seems to me that
the XML parser shoud use the CHARSET defined on the iTip XML anyway... don't
it?

If someone has ideas for a better fix or where the problem really is I would
like to know.

Thanks in advance,

  Sergio.

-- 
Sergio Talens-Oliag <[email protected]>               <http://www.iti.es/>
Key fingerprint = FF77 A16B 9D09 FC7B 6656 CFAD 261D E19A 578A 36F2
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.