I am using ActionMailer to parse incoming email from gmail. I found that multi-part emails coming from Outlook clients are encoded with charset='Windows-1252'. After creating a mail object (see Receiver.receive() below) each part.body has charset='UTF-8' and defaulted_charset=true. When I grab part.body.to_s the characters aren't encoded correctly (hyphen encoded as =96 results in non- printable char in UTF-8 string from to_s). I was assuming it would grab the charset off the part header, but didn't see anything in initialize that would do that (seems biased for composing email rather than parsing existing).
Is this a limitation, defect, or just my ignorance? Thanks for any help. As a workaround, I'm calling force_encoding() on the string and then explicitly encoding to UTF-8.
Mark
Rails 3.0.10
class Receiver < ActionMailer::Base def receive(email) email end end