Weird Character Encoding Issue in ActionMailer


I have my application setup so that e-mail templates are stored in the
database, and each time an e-mail is sent out, a new entry is entered
into the database with the email_template_id, what e-mail-specific
variables must be included in the template (ex. a user’s first name, a
product URL, etc.) that change with each e-mail. A process then runs
in the background and takes these e-mails, replaces the e-mail-
specific variables into the template, and mails it out.

When the e-mail-specific variables are put in the database, they first
get converted into YAML, so if a user’s name was Brontë, it becomes
Bront\xC3\xAB in the YAML format.

When the variables (such as the first name) get loaded by the process
back into the e-mail from the database YAML, in IRB I see that the
body text of the e-mail has the name correctly converted back to


=> "Hi Brontë (rest of email)

However, when this e-mail gets passed to ActionMailer and delivered,
the e-mail appears as:

Hi Bront=C3=AB,

The charset attribute on the e-mails is UTF-8 (the ActionMailer
default) which isn’t overridden when the mail is sent.

Any ideas?


You can set the mail headers for text/html apart frmo that like wat u
have done UTF-8 is proper…

also u can see that the table field is set to UTF format that might also
solve th e issue


Dhaval P.
Software Engineer