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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to