avoid failed encodings / stop bad charsets early

@bf4 @jeremy 

hotfix:
```Ruby
module NoInvalidEncoding
  def pick_encoding(enc)
    Encoding.find(super(enc)).to_s
  rescue ArgumentError
    "ISO-8859-1"
  end
end

class << Mail::Ruby19
  prepend NoInvalidEncoding
end
```
 - convert_to_encoding is not tested because it is private
 - enforcing in each branch would mean a bunch of copy-paste, either way is
fine by me, but I'd prefer dry

On Tue, Nov 4, 2014 at 1:36 PM, Benjamin Fleischer <notifications@github.com
> wrote:

> In lib/mail/version_specific/ruby_1_9.rb:
>
> > @@ -188,6 +188,24 @@ def Ruby19.pick_encoding(charset)
> >        else
> >          charset
> >        end
> > +
> > +      convert_to_encoding(encoding)
> > +    end
> > +
> > +    class << self
> > +      private
> > +
> > +      def convert_to_encoding(encoding)
>
> @jeremy <https://github.com/jeremy> any thoughts? I'm not sure what the
> impact of any design decisions we make here may be.
>
> The only potential downside I see right now is not being able to specify a
> different 'fallback' encoding, and that the convert_to_encoding method
> isn't tested.
>
> In terms of design, for example, isn't the problem this patch fixes really
> that the case statement has two return types?
>
>   encoding = case charset
>      when /^iso-?8859-(\d+)(-i)?$/i
>         "ISO-8859-#{$1}"
>     when /^8bit$/
>         Encoding::ASCII_8BIT
>     end
>    convert_to_encoding(encoding)
>
> Why not ensure the correct return type in each branch?
>
>   case charset
>      when /^iso-?8859-(\d+)(-i)?$/i
>         convert_to_encoding("ISO-8859-#{$1}")
>     when /^8bit$/
>         Encoding::ASCII_8BIT
>     end
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mikel/mail/pull/775/files#r19837956>.
>