nwcell / ics.js

A browser firendly VCS file generator written entirely in javascript!!!!!!
MIT License
620 stars 258 forks source link

Line breaks in the description #26

Open getsetbro opened 9 years ago

getsetbro commented 9 years ago

I've tried adding a line break "\n" in the description but it doesn't work. It creates a line break in the file but the "\n" needs to end up in the ics file.

LeonardoGomesRibeiro commented 8 years ago

I have tried the same and it just not work... I've also tried to insert HTML tags but is not working neither.

RunasSudo commented 7 years ago

This appears to be due to ics.js's lack of support for the ICS specification requirement that certain characters, such as newlines, colons and semicolons, be escaped. A newline must be encoded as a literal "\n" sequence, a colon as "\," and a semicolon as "\;".

For example:

cal.addEvent("An Event", "This description contains a newline.\\nThis is the second line", ...)

Ideally ics.js should support this automatically, but it does not appear to do so.

raxod502 commented 6 years ago

A dumb workaround (which nevertheless got my calendar export working) is to just put literal \n sequences into your description instead of actual newline characters.

abhidj0090 commented 3 years ago

was anybody successful in putting html tags in the description ??

raxod502 commented 3 years ago

I never tried it, but you could try backslash-escaping the angle brackets and comparing the resulting ICS file with one generated by a standards-compliant program.