Skip to content

Instantly share code, notes, and snippets.

@dakatsuka
Created April 17, 2011 14:14
Show Gist options
  • Select an option

  • Save dakatsuka/924061 to your computer and use it in GitHub Desktop.

Select an option

Save dakatsuka/924061 to your computer and use it in GitHub Desktop.
Mailライブラリのsubjectをデコードする機能を上書き(EncodingからKconvを使うように変更)
# 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