mailcvt 0.2.30 → 0.2.31

Sign up to get free protection for your applications and to get access to all the features.
data/lib/encoded_word.rb CHANGED
@@ -162,31 +162,11 @@ class EncodedWord
162
162
 
163
163
  def word_decode(input, out_charset = 'utf-8')
164
164
  u8 = input.encode('utf-8', @u8_enc, :undef=>:replace, :invalid=>:replace)
165
- pos1 = u8.index('=?')
166
- return input unless pos1
167
- pos2 = u8.index('?=', pos1+1)
168
- trim = u8[pos1..pos2+1]
169
- parts = trim.scan(/=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/).first
165
+ parts = u8.scan(/=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/).first
166
+ return input unless parts and parts.length == 3
170
167
  charset = parts[0]
171
168
  enc = parts[1].upcase
172
169
  wd = parts[2].unpack({ "B"=>"m*", "Q"=>"M*" }[enc]).first
173
170
  wd.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
174
171
  end
175
-
176
- def mime_decode(input, out_charset = 'utf-8')
177
- return '' unless input and input.length > 0
178
- begin
179
- ret = input.sub!(/=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/) {
180
- charset = $1
181
- enc = $2.upcase
182
- word = $3
183
- word = word.unpack({ "B"=>"m*", "Q"=>"M*" }[enc]).first
184
- word.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
185
- }
186
- return ret ? mime_decode(input) : input
187
- rescue => e
188
- puts e
189
- return input
190
- end
191
- end
192
172
  end
@@ -1,3 +1,3 @@
1
1
  module Mailcvt
2
- VERSION = '0.2.30'
2
+ VERSION = '0.2.31'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailcvt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.30
4
+ version: 0.2.31
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: