mikel/mail — pull request #738 by mkdynamic (2014-07-18 04:32:59+00:00)
Title: Set the Ruby string encoding from the charset

Related: https://github.com/mikel/mail/issues/618#issuecomment-49389043

When getting the decoded string back for the body of a `Message` which is text (i.e. `text?` is true), the original encoding (which should be present in the charset) is lost, and it currently always forces to UTF-8. That seems bad, since if we know the "right" encoding (which we do, presuming the charset on the message is correct) if seems more desirable to use it.

The encoding stuff seems super hairy, so if I've totally misunderstood something, let me know :)

Only implemented for Ruby 1.9+, I'm not sure it's possible for < 1.9 since we do not know the current string encoding to pass to `Iconv`. Let me know if there is a way.