mailcvt 0.2.35 → 0.2.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -174,22 +174,22 @@ class EncodedWord
174
174
  end
175
175
 
176
176
  def word_decode(input, out_charset = 'utf-8')
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
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
+ begin
184
+ return wd.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
185
+ rescue => e
186
+ puts "Cannot encode #{input} because #{e}, try iconv..."
183
187
  begin
184
188
  return Iconv.conv(out_charset + "//IGNORE", charset, wd)
185
189
  rescue => e
186
- puts "Cannot iconv #{input} because #{e}, try encode."
187
- begin
188
- return wd.encode(out_charset, charset, :undef=>:replace, :invalid=>:replace)
189
- rescue => e
190
- puts "Cannot encode #{input} because #{e}"
191
- end
190
+ puts "iconv failed too because #{e}."
192
191
  return ''
193
192
  end
193
+ end
194
194
  end
195
195
  end
@@ -1,3 +1,3 @@
1
1
  module Mailcvt
2
- VERSION = '0.2.35'
2
+ VERSION = '0.2.36'
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.35
4
+ version: 0.2.36
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: