TL;DR Update your icalendar module to the latest (beta) build.
As the title suggests, if you’re having the same issue I had where Google Calendar seemingly deleted random spaces between words, on an imported calendar (iCal/.ics file) generated by the python icalendar module, then read on!
Versions 3.0 (which is, in itself, recent), and older, of this module correctly wrapped long lines in the generated iCal file. However, they also incorrectly stripped whitespace from the end of lines in that wrapping, or folding, process. The iCal spec does call for wrapping of long lines, and specifically sets out that the next line should start with a space.
So, whilst it looks line a wrapped line has the correct whitespace between words, the first space character of the second/subsequent line isn’t part of the text. The previous line (assuming the wrapping has been performed nicely between two words) should end with a space; which, crucially, was being deleted in error. The result is Google Calendar correctly removes the space at the start of the second line (it being part of the protocol), leaving the last word on line 1 and the first word on line 2 to now be joined. The raw iCal file can be deceiving in that case, trust me!
To fix this, simply update to the latest version (a v3.1.x, or directly from source). If you can’t do that (for reasons other than file permissions!), you can also edit the offending line in icalendar/parser.py
. Search for drop_whitespace
and change it from True
to False
. A simple fix, when you know how! If that still doesn’t work, make sure to remove any older/conflicting versions of the module, and to restart the server/script that’s using it.
Update: Of course you were not using the original, and now obsolete, codespeak.net/icalendar/ page, were you? Of course not, but do note it’s now under active development again (with the blessing of original authors) at GitHub.