Converting UTF-8 Data to Outlook Compatible Charset

A problem in a current Rails app just found a decent solution, as Danish letters like æøå did not show up decently. It turned out (surprise) that Outlook had a problem accepting UTF-8 charset.

On the Meeting model in the Rails app I want to save to calendar in an Outlook compatible format. We solved it like this by converting from UTF-8 to ISO-8859-1 when creating the icalendar event.

[code lang=”ruby”]
require ‘icalendar’
require ‘date’

class Meeting < ActiveRecord::Base belongs_to :room belongs_to :journal def to_event event = event.summary = "Møde " + (journal.number || "no number..") event.description = description.split("\n").join("\n\n") event.klass = "PUBLIC" event.start = start.to_datetime event.end = self.end.to_datetime event.location = + " " event end [/code] And meetings_controller.rb: [code lang="ruby"] require 'icalendar' require 'iconv' class MeetingsController < ApplicationController include Icalendar def show @courtmeeting = Courtmeeting.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @courtmeeting }
format.ical { render :text => render_to_ical([@courtmeeting]) }

def render_to_ical(courtmeetings)
headers[‘Content-Type’] = “text/calendar; charset=ISO-8859-1”
cal =
courtmeetings.each do |meeting|
Iconv.iconv(‘ISO-8859-1’, ‘UTF-8’, cal.to_ical).to_s
Very simple, yet very effective way to have your meetings exposed to Outlook in a way that solves the character encoding problems.

Technorati Tags: , , , , , , ,

5 Responses to “Converting UTF-8 Data to Outlook Compatible Charset”

  1. Jorrit Schippers Says:

    This article suggests that Outlook 2003 is incapable of accepting UTF-8 messages. This is not true. It might be a component between the originating mailserver and Outlook that mangles the contents, as I have experienced myself. To be on the safe side, use Content-Transfer-Encoding: quoted-printable (and encode the contents accordingly)

  2. thomas Says:

    Hew what about outlook 2007 ? but character encoding problems ? Thanks for your info man ! Help Me

  3. Simon Says:

    We have this problem on Outlook 2007, we send the body as UTF-8 with the correct encoding type in header, but Outlook views it as not UTF-8.

  4. Jack Heath Says:

    This issue was related to the system not reading the correct encoding for the file. It was a common bug in 2003 which may carry over to Outlook 2007/2010 emails sent from an unpatched 2003 client in text format. To resolve it, I just opened an email (any email will work) and added then encoding option to the quick-bar, then I selected UTF-8 as an encoding option. Once done, Outlook will add UTF-8 to the list and be able to autos-elect between both UTF-Western and UTF-8 formats.

  5. Anibal Trejo Says:

    Thanks! Ive used part of this info to solve Outlook problem reading my html generated signature. Since i have spanish with accents on it, Outlook was translating accented characters into rubbish. :)