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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Hi Mark, I recently came across a similar encoding problem with email and used #force_encoding as you describe. The issue is with the Mail gem<https://github.com/mikel/mail>that ActionMailer uses. The gem currently has many encoding issues filed<https://github.com/mikel/mail/issues/search?q=encoding>and it''s hard to see if this exact MIME part encoding problem has been raised. Regards, Andrew -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/zhuKaDFRYAsJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Hi Andrew, thanks for the note. I found a google group for mail and found a related thread: http://groups.google.com/group/mail-ruby/browse_thread/thread/fdf0e9ef275cf327 Looks like stepchud has a few patches for this: https://github.com/stepchud/mail/commits/actionmailer-2.3.8_compatible but hasn''t gotten around to submitting pull request. Best, Mark -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.