# ActionMailer encoding

**URL:** <https://www.ruby-forum.com/t/actionmailer-encoding/108247>\
**Category:** Rails\
**Created:** [July 1, 2007, 12:11am UTC](https://www.ruby-forum.com/t/actionmailer-encoding/108247 "2007-07-01T00:11:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spacen\_Jasset](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e274bd/32.png) [@Spacen\_Jasset](https://www.ruby-forum.com/u/Spacen_Jasset)\
**Post date:** [July 1, 2007, 12:11am UTC](https://www.ruby-forum.com/t/actionmailer-encoding/108247/1 "2007-07-01T00:11:21Z")

</div>

Hi,

I am using ActionMailer to recieve emails as per the usual method. I  
use postfix.

My Database is setup for utf8 encoding. I get a database error when I  
try to store email.body into a record in the database. This means that  
action mailer is returning the body string in the original email  
encoding.

abstract\_adapter.rb:128:in `log’: RuntimeError: ERROR C22021  
Minvalid byte sequence for encoding “UTF8”: 0x92

Mime-Version: 1.0  
Content-Type: text/plain; charset=ISO-8859-1

How should I handle this? Must I use Iconv to manually convert this  
data by examining the content-type field of the email? The body must  
end up in utf8 form when it gets stored into the database.

Regards,

Jason
