]> git.openstreetmap.org Git - rails.git/blob - config/initializers/mail.rb
Remove backported code now we are using mail 2.4.1
[rails.git] / config / initializers / mail.rb
1 module Mail
2   class Ruby18
3     def Ruby18.b_value_decode(str)
4       match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
5       if match
6         encoding = match[1]
7         str = Ruby18.decode_base64(match[2])
8         require 'iconv'
9         str = Iconv.conv("UTF-8//TRANSLIT//IGNORE", encoding, str)
10       end
11       str
12     end
13
14     def Ruby18.q_value_decode(str)
15       match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
16       if match
17         encoding = match[1]
18         str = Encodings::QuotedPrintable.decode(match[2].gsub(/_/, '=20'))
19         require 'iconv'
20         str = Iconv.conv("UTF-8//TRANSLIT//IGNORE", encoding, str)
21       end
22       str
23     end
24   end
25 end