UsingLibical.txt says about multiple categories
"However when you convert a component to a string, the library will collect all of the CATEGORIES properties into one. "
But this does not work. If I add 3 new category properties to an event and then call icalcomponent_as_ical_string() I get three single valued CATEGORIES properties, not one as suggested.
There is a related categories bug # 3385364
to get all the categories into 1 property you need to join them yourself and then use icalproperty_new_categories()
In KDE we do it like so:
QString categories = incidence->categories().join( "," );
if ( !categories.isEmpty() ) {
icalcomponent_add_property(
parent, icalproperty_new_categories( categories.toUtf8() ) );
}
now, in libical 0.46 and older that will result in the commas being escaped, for example:
CATEGORIES:Birthday\,Personal
but in libical 0.47 and above that has been fixed and you should see, for example:
CATEGORIES:Birthday,Personal
I found the change in 0.47 in icalmemory_strdup_and_quote(), but I think there is a bug because the ; and , case statements should be reversed, because at the moment, it will not escape a ; either, making it illegal. Just put the case ',' before the case ';'
However, it's not clear whether the text icalvalue implementation will support quoted strings and what would happen if you add the category "Hotels, Australia", i.e. where that means a SINGLE double quoted category containing a comma, which I understand is perfectly legal