Output ical .ics file, encoding/escaping?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Output ical .ics file, encoding/escaping?

Post by batfastad »

Hi everyone

We output a variety of different formats of data from our intranet database using PHP.
But I was wondering what the best way to output iCal/ics files was.

Do I need to escape and special characters for outputting an ics file?
Is there any special encoding I should use for text/data in the various fields of ics files?

At the moment this is the header I use to output a .ics file:

Code: Select all

header('Content-type: text/calendar; Content-encoding: utf-8');
Then I just echo the data straight out in utf8 from my database. No escaping or encoding or anything.

Should I be escaping or encoding the data before I echo it out into an .ics file?
Any other comments/suggestions with this approach?

Cheers, B
Post Reply