mailcvt 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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