[icalendar-dev] Possible bug: Linebreaks mess up unicode?
Brad
ykardia at gmail.com
Thu Oct 19 12:49:03 CEST 2006
Hi,
just tried loading a python-icalendar-generated ics file in the new
Sunbird, and it complained that it wasn't utf-8. I investigated, and
found that it looks as if the unicode is possibly messed up by the
linebreaking. The same file shows up fine in Apple iCal and in Novell
Evolution, so it is possible that Sunbird is just being too strict.
When I run the generated file through iconv like so:
iconv -f UTF-8 -t UTF-8 mycal.ics
iconv also complains.
Here is a script that reproduces the issue (I hope Gmail doesn't mess
up the whitespace and linebreaks...):
--------------------
import icalendar
if __name__ == "__main__":
desc1 = u'XXXXX Conference:\n"Gesti\xf3n de riesgos en el sector del
petr\xf3leo"'
desc2 = u'XXXXXX Conference:\n"Gesti\xf3n de riesgos en el sector
del petr\xf3leo"'
c = icalendar.Calendar()
c.add('prodid', '-//The test Calendar//xxxx.es//')
c.add('version', '2.0')
e = icalendar.Event()
e.add('description', desc1)
f = icalendar.Event()
f.add('description', desc2)
c.add_component(e)
c.add_component(f)
print 'desc1:' + desc1.encode('utf-8')
print 'desc2:' + desc2.encode('utf-8')
fh = open('test.ics', 'wb')
fh.write(c.as_string())
fh.close()
--------------------
If I run this, the first description (desc1) will create an entry for
which there is a linebreak just at the second \xf3 (accented o). This
seems to mess it up. For desc2, an entry is created that has a line
break before the second \xf3, so it is not messed up. (I have tried
pasting the output below, but have no idea as to how this will come
out).
Is this a bug in Sunbird or in icalendar?
Can anyone help me?
I can replicate this on
Mac OS X 10.4.7, python 2.4.3, icalendar 0.11
Fedora Core 5, python 2.4.2, icalendar 0.11
Thanks.
A Different Max (not Max M)
test.ics:
---------------------------------
BEGIN:VCALENDAR
PRODID:-//The test Calendar//cemfi.es//
VERSION:2.0
BEGIN:VEVENT
DESCRIPTION:XXXXX Conference:\n"Gestión de riesgos en el sector del petr?
?leo"
END:VEVENT
BEGIN:VEVENT
DESCRIPTION:XXXXXX Conference:\n"Gestión de riesgos en el sector del petr
óleo"
END:VEVENT
END:VCALENDAR
More information about the icalendar-dev
mailing list