mailcvt 0.2.21 → 0.2.22
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/encoded_word.rb +12 -8
- data/lib/mailcvt/version.rb +1 -1
- metadata +1 -1
data/lib/encoded_word.rb
CHANGED
@@ -106,13 +106,17 @@ class EncodedWord
|
|
106
106
|
|
107
107
|
def mime_decode(input, out_charset = 'utf-8')
|
108
108
|
return '' unless input and input.length > 0
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
109
|
+
begin
|
110
|
+
ret = input.sub!(/=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/) {
|
111
|
+
charset = $1
|
112
|
+
enc = $2.upcase
|
113
|
+
word = $3
|
114
|
+
word = word.unpack({ "B"=>"m*", "Q"=>"M*" }[enc]).first
|
115
|
+
word.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
|
116
|
+
}
|
117
|
+
return ret ? mime_decode(input) : input
|
118
|
+
rescue
|
119
|
+
return input
|
120
|
+
end
|
117
121
|
end
|
118
122
|
end
|
data/lib/mailcvt/version.rb
CHANGED