mikel/mail — pull request #335 by janv (2012-01-20 12:32:25+00:00)
Title: Fix for Mail::Encodings.unquote_and_convert

Fixed an issue where Mail::Encodings.unquote_and_convert did not correctly handle strings that had unquoted characters mixed in between quoted strings.

I found an email subject that was missing characters in Mail that were rendered by mail programs such as Mail.app or Sparrow. I could trace down the issue to some regular expressions that were not prepared for this case. The problem was a single unquoted character between two quoted chunks:

```
=?iso-2022-jp?B?GyRCP3AwQxsoQg==?=2=?iso-2022-jp?B?GyRCIiobKEI=?=
```

This should have resulted in something like
瑞庵2→最近門松を飾る家がほ
but came out as
→最近門松を飾る家がほ
insted

The "2" there, and everything before it were not correctly decoded in Mail.
My patch fixes the recognition of

**Spec to recreate the issue included** (run example with and without my patch to the unquote_and_convert method to see the difference.)

**Tested against 1.8.7 and 1.9.3**