From: Nicolas Pouillard Date: Mon, 6 Jul 2009 07:50:09 +0000 (+0200) Subject: easy_decode now also catches InvalidCharacter X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=c22daac3e78f01eb1b34934ce2cc441ffc8a2e42;p=sup easy_decode now also catches InvalidCharacter --- diff --git a/lib/sup/rfc2047.rb b/lib/sup/rfc2047.rb index fcd5cf0..f31faa1 100644 --- a/lib/sup/rfc2047.rb +++ b/lib/sup/rfc2047.rb @@ -52,11 +52,7 @@ module Rfc2047 # WORD. end - begin - Iconv.easy_decode(target, charset, text) - rescue Iconv::InvalidCharacter - text - end + Iconv.easy_decode(target, charset, text) end end end diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 8f60cc4..d76d2a3 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -651,7 +651,7 @@ class Iconv begin Iconv.iconv(target + "//IGNORE", charset, text + " ").join[0 .. -2] - rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::IllegalSequence => e + rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::InvalidCharacter, Iconv::IllegalSequence => e Redwood::log "warning: error (#{e.class.name}) decoding text from #{charset} to #{target}: #{text[0 ... 20]}" text end