How to decode subject fetched via Net::IMAP which in UTF8? (ruby)
imap, jruby, ruby, utf-8
Solution
The answer is:
`Mail::Encodings.unquote_and_convert_to( string, 'utf-8' )`
The point is that encoding of email subjects is "QUOTED-PRINTABLE" encoding (by default for Gmail).
Problem
I'm using Net::IMAP.fetch to fetch some messages from Gmail. However, when I fetch a message which has a UTF8 subject (i.e., in cyrillic) I get something like this: ``` =?UTF-8?B?0KHRgNC/0YHQutC4INGE0L7RgNGD0Lwg0YLRgNCw?= =?UTF-8?B?0LbQuCDQuNC30LHQvtGA0L3QuCDQvNCw0YLQtdGA0Lg=?= =?UTF-8?B?0ZjQsNC7INC4INC90LAg0ZvQuNGA0LjQu9C40YY=?= =?UTF-8?B?0LggLSBjaXJpbGFjZSB0ZXN0?= ``` How can I convert the above string into UTF8? NOTE: this is for ruby 1.8.7