mailcvt 0.2.32 → 0.2.33

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 CHANGED
@@ -173,12 +173,17 @@ class EncodedWord
173
173
  end
174
174
 
175
175
  def word_decode(input, out_charset = 'utf-8')
176
- u8 = input.encode('utf-8', @u8_enc, :undef=>:replace, :invalid=>:replace)
177
- parts = u8.scan(/=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/).first
178
- return input unless parts and parts.length == 3
179
- charset = parts[0]
180
- enc = parts[1].upcase
181
- wd = parts[2].unpack({ "B"=>"m*", "Q"=>"M*" }[enc]).first
182
- wd.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
176
+ begin
177
+ u8 = input.encode('utf-8', @u8_enc, :undef=>:replace, :invalid=>:replace)
178
+ parts = u8.scan(/=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/).first
179
+ return input unless parts and parts.length == 3
180
+ charset = parts[0]
181
+ enc = parts[1].upcase
182
+ wd = parts[2].unpack({ "B"=>"m*", "Q"=>"M*" }[enc]).first
183
+ wd.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
184
+ rescue => e
185
+ puts "Cannot decode #{input} because #{e}"
186
+ return ''
187
+ end
183
188
  end
184
189
  end
@@ -1,3 +1,3 @@
1
1
  module Mailcvt
2
- VERSION = '0.2.32'
2
+ VERSION = '0.2.33'
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.32
4
+ version: 0.2.33
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: