April 23, 2011

Blog has been moved

This post has been moved to blogspot. No further posts will be made to this location.

Accented chars in calendars

I've been working on a side project where I scape a bunch of pages and change the info into an ical file so that I can use it in google calendar. More about that project later.

I ran into some problems with accented characters (of course) always showing up broken. I think that I have a solution (not 100% sure yet because it takes a while for google to refresh a feed). A super helpful post mentioned that "The HTTP/1.1 standard says that if content-type is text/* and no charset is given, the character set (encoding) is ISO-8859-1 (latin1).". A quick "curl -i" on my url and sure enough the http header only had Content-Type: text/calendar.

Mostly I've always dealt with server code, not configing apache, and especially not on a host where I may not have access to change config. A little bit more searching lead to a post about changing the .htaccess file. Added a line saying AddType 'text/calendar; charset=utf-8' ics, double check with my curl command and the file is returning the correct header.

This took me a bit of digging because I thought that it was something wrong with how I was writing the file and needing to change the libs that I was using. Apparently I was just screwing things up because I was opening them with textedit which showed the files as broken. Opening them in ical (which I don't use) showed everything correctly. A day of searching leads to new knowledge and a 3 minute fix. Ah, software...

Update: it worked.

Posted by jim at April 23, 2011 12:44 PM
Comments
Due to the proliferation of comment spam, I’ve had to close comments on this entry. If you would like to leave comment, please use one of my recent entries. Thank you and sorry for any inconvience caused.