Created
April 17, 2011 14:14
-
-
Save dakatsuka/924061 to your computer and use it in GitHub Desktop.
Mailライブラリのsubjectをデコードする機能を上書き(EncodingからKconvを使うように変更)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| module Mail | |
| class Ruby19 | |
| def Ruby19.b_value_decode(str) | |
| match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m) | |
| if match | |
| encoding = match[1] | |
| str = Ruby19.decode_base64(match[2]) | |
| str.force_encoding(fix_encoding(encoding)) | |
| end | |
| str.toutf8 | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment